How can I print subparagraphs? I have a content type with a paragraph field. That paragraph field has two paragraph fields which I will refer to as subparagraphs.

I want to print one of the two subparagraphs depending on the flag set in the preprocess function.

Paragraph: field_banner_header

Subparagraphs: field_banner_header_single, field_banner_header_multi

Twig:

&lt;div class="callout-options"&gt;
    {% if callout_options == 'Single' %}
        {{ content.field_banner_header[0]['#node'].field_banner_header_single.value }}
    {% else %}
        {{ content.field_banner_header[0]['#node'].field_banner_header_multi.value }}
    {% endif %}
&lt;/div&gt;


I have a preprocess hook that stores the value ('Single' or 'Multi') of a bool in callout_options: 

function cse_preprocess_node(&amp;$variables) {
  $node = $variables['elements']['#node'];

  if ($node-&gt;getType() == 'unit_landing_page') {
    $variables['callout_options'] = $node-&gt;get('field_active_callout_tab')-&gt;value;
  }
}


On page render, I get the following error:


  drupal.js?v=8.4.6:13 Uncaught Quick Edit could not associate the
  rendered entity field markup (with
  [data-quickedit-field-id="paragraph/426/field_banner/en/default"])
  with the corresponding rendered entity markup: no parent DOM node
  found with [data-quickedit-entity-id="paragraph/426"]. This is
  typically caused by the theme's template for this entity type
  forgetting to print the attributes.


I could be wrong, but this seems to be telling me that I am referencing the subparagraph incorrectly.

What is the correct syntax for printing a subparagraph?
Seems your preprocess function is the key. To get the value of a field, do the following:

$callout_tab = $node-&gt;get('field_active_callout_tab')-&gt;first()-&gt;getValue();
$variables['callout_options'] = $callout_tab['value'];


Really, please install the Devel submodule Kint and then check first what you get:

ksm($node-&gt;get('field_active_callout_tab')-&gt;value);


Which will most likely get you NULL or an array. So {% if callout_options == 'Single' %} can never work.



And regarding the subparagraph, all I could get was the entity ID:

{{ kint(content.field_paragraphs.0['#paragraph'].get('field_subparagraph').value) }}


but maybe I'm doing something wrong (and you already solved that yourself). But if the entity ID really is the maximum you can get you are better off loading the subparagraph in the preprocess function as well and pass the render array over to Twig like you did pass the bool. In theory this should work :)