field--node--field-image.html.twig

Same filename in other branches
  1. 9 core/themes/olivero/templates/field/field--node--field-image.html.twig
  2. 11.x core/themes/olivero/templates/field/field--node--field-image.html.twig

Theme override for the image field.

Available variables:

  • attributes: HTML attributes for the containing element.
  • label_hidden: Whether to show the field label or not.
  • title_attributes: HTML attributes for the title.
  • label: The label for the field.
  • multiple: TRUE if a field can contain multiple items.
  • items: List of all the field items. Each item contains:
    • attributes: List of HTML attributes for each item.
    • content: The field item's content.
  • entity_type: The entity type to which the field belongs.
  • field_name: The name of the field.
  • field_type: The type of the field.
  • label_display: The display settings for the label.

See also

template_preprocess_field()

File

core/themes/olivero/templates/field/field--node--field-image.html.twig

View source
  1. {#
  2. /**
  3. * @file
  4. * Theme override for the image field.
  5. *
  6. * Available variables:
  7. * - attributes: HTML attributes for the containing element.
  8. * - label_hidden: Whether to show the field label or not.
  9. * - title_attributes: HTML attributes for the title.
  10. * - label: The label for the field.
  11. * - multiple: TRUE if a field can contain multiple items.
  12. * - items: List of all the field items. Each item contains:
  13. * - attributes: List of HTML attributes for each item.
  14. * - content: The field item's content.
  15. * - entity_type: The entity type to which the field belongs.
  16. * - field_name: The name of the field.
  17. * - field_type: The type of the field.
  18. * - label_display: The display settings for the label.
  19. *
  20. *
  21. * @see template_preprocess_field()
  22. */
  23. #}
  24. {% extends 'field.html.twig' %}
  25. {% set attributes = attributes.addClass('primary-image') %}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.