Access the value of a disabled field in a twig template I'm using the Paragraphs module to create components, i then make a content type and add the Paragraph as a reference field.

The form of the Paragraph has a field (a list) where a content creator can select a color name for a background color for the div. Each Paragraph has 3 values (pacific_blue, smokey_white, white).

However, i'm trying to get the selected value without displaying it on the site.

As long as the field is not disabled i can get the value using this code and add the class to style the div with the right background color:

&lt;div class="c14a {{ content.group_wrap.field_color_backgroud.0["#markup"] }}"&gt;
  &lt;div{{ attributes.addClass(classes) }}&gt;
      {{ content }}
  &lt;/div&gt;
&lt;/div&gt;


So how do i get the value of a field that is disabled in 'manage display'?

Thx...
Try to add it on you hook_preproccess_node to variables.

something like following snippet could help you.

on your THEMENAME.theme

function THEMENAME_preprocess_node(&amp;$vars) {
    $node = $vars['node'];
    if(isset($vars['node']) &amp;&amp; $vars['node']-&gt;getType()=='YOUR_CONTENT_TYPE_MACHINE_NAME') {
        $values = $node-&gt;field_color_backgroud-&gt;entity-&gt;getValue();
        $vars['myvar'] = $values[0];
    }

}


Then on your TWIG file {{ myvar }} will be available.