Created
March 27, 2017 14:20
-
-
Save druman/ca724c89c5f27b727d34ed07965c9300 to your computer and use it in GitHub Desktop.
Change src pictures on data-src in field
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function themename_preprocess_field(&$variables, $hook) { | |
$element = &$variables['element']; | |
if ($element['#entity_type'] == 'NAME'){ | |
foreach ($variables['items'] as $key => $val) { | |
$output = $val['#markup']; | |
$delta = str_replace('src', 'data-src', $output); | |
}; | |
$variables['items'] = array( | |
'#markup' => $delta, | |
); | |
}; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment