theming-example-content-array.html.twig

Same filename in other branches
  1. 4.0.x modules/theming_example/templates/theming-example-content-array.html.twig

Theme a simple content array.

This template uses the newer recommended format where a single render array is provided to the theme function.

File

modules/theming_example/templates/theming-example-content-array.html.twig

View source
  1. {#
  2. /**
  3. * @file
  4. * Theme a simple content array.
  5. *
  6. * This template uses the newer recommended format where a single
  7. * render array is provided to the theme function.
  8. */
  9. #}
  10. {% for item in element['#items'] %}
  11. {% if not loop.index %}
  12. {# The first paragraph is bolded. #}
  13. <p><strong>{{ item }}</strong></p>
  14. {% else %}
  15. {# Following paragraphs are just output as routine paragraphs. #}
  16. <p>{{ item }}</p>
  17. {% endif %}
  18. {% endfor %}