I am trying to use mytheme_preprocess_field() to alter how a field is displayed. Here is the code I added to my theme’s template.php:
function creative_responsive_theme_preprocess_field(&$vars) { $element = &$vars['element']; if ($element['#field_name'] == 'field_myfield') { $element['#items'][0]=[]; $element['#items'][0]['value'] = 'replaced value'; $element['#items'][0]['format'] = 'filtered_html'; $element['#items'][0]['safe_value'] =''; $element['#items'][0]['#markup'] = 'replaced value'; return; } }
I confirmed that the code is being executed, but the rendering of the page does not reflect what I have done in the code. The field is being displayed as usual. I am using display suite. Not sure if that effects anything, but searching online, I see no indication that above should not work. And I added the #markup part because I read that is truly what one has to do…
Ideas?
regards