I am attempting to override a node field value in Drupal 8 (on output) using template_preprocess_node. Specifically, I am attempting to override the text of a long text field. I am currently using this:
function THEMENAME_preprocess_node(&$variables) {
$variables['content']['field_content'] = array(
'#type' => 'markup',
'#markup' => '<p>Testing 123</p>',
);
}
And that works, but it totally overrides the field, removing the classes I added to the field wrapper, etc.
Does anyone know how to just set the value only, without replacing the entire field theming, etc? I do not want to manually add the field wrapper classes to #markup.
'#type' => 'processed_text', '#text' => 'Testing 123',
– No Sssweat Aug 3 '17 at 4:54