TWIG loop paragraph items

 


<h1>Homepage node</h1>
<article{{ attributes }}>
{{  node.field_text_under_slogan.value }}


  <div>


{% if content.field_key_visual_swiper['#items']|length > 0 %}


  {% for item in content.field_key_visual_swiper %}
 
   
    {% set paragraph = item['#paragraph'] %}
   

    {% if paragraph.field_button_colour and paragraph.field_button_colour.0.value.color %}
      <div style="background-color: {{ paragraph.field_button_colour.0.value.color }}">
        Button Color: {{ paragraph.field_button_colour.0.value.color }}
      </div>
    {% endif %}
 
  {% endfor %}

{% endif %}
   

   
  </div>


</article>

留言

此網誌的熱門文章

Install Drupal 10 with composer in XAMPP htdocs OR PHP Command

fix drupal 11 install error

[custom block module]Correcting Heredoc Syntax and Attaching JS