Overriding field values in Drupal 8 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(&amp;$variables) {
  $variables['content']['field_content'] = array(
    '#type' =&gt; 'markup',
    '#markup' =&gt; '&lt;p&gt;Testing 123&lt;/p&gt;',
  );
}


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.
After doing a quick test, turns out that hook_preprocess_node will always override hook_preprocess_field's attributes.

Therefore, instead of adding the class in hook_preprocess_field, and if you don't want to use '#markup', you could add it in hook_preprocess_node like this:

function THEMENAME_preprocess_node(&amp;$variables) {
    $variables['content']['field_test'] = array(
    '#type' =&gt; 'processed_text', 
    '#text' =&gt; 'Test 123',
    '#prefix' =&gt; '&lt;div class="your-class"&gt;',
    '#suffix' =&gt; '&lt;/div&gt;',
  );
}