You are here

field-gutenberg-text.html.twig in Gutenberg 8.2

Default theme implementation for a Gutenberg text field.

To override output, copy the "field-gutenberg-text.html.twig" from the templates directory to your theme's directory and customize it, just like customizing other Drupal templates such as page.html.twig or node.html.twig.

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.

File

templates/field-gutenberg-text.html.twig
View source
  1. {#
  2. /**
  3. * @file
  4. * Default theme implementation for a Gutenberg text field.
  5. *
  6. * To override output, copy the "field-gutenberg-text.html.twig" from the templates directory
  7. * to your theme's directory and customize it, just like customizing other
  8. * Drupal templates such as page.html.twig or node.html.twig.
  9. *
  10. * Available variables:
  11. * - attributes: HTML attributes for the containing element.
  12. * - label_hidden: Whether to show the field label or not.
  13. * - title_attributes: HTML attributes for the title.
  14. * - label: The label for the field.
  15. * - multiple: TRUE if a field can contain multiple items.
  16. * - items: List of all the field items. Each item contains:
  17. * - attributes: List of HTML attributes for each item.
  18. * - content: The field item's content.
  19. * - entity_type: The entity type to which the field belongs.
  20. * - field_name: The name of the field.
  21. * - field_type: The type of the field.
  22. * - label_display: The display settings for the label.
  23. *
  24. * @see template_preprocess_field_gutenberg_text()
  25. *
  26. * @ingroup themeable
  27. */
  28. #}
  29. {% for item in items %}
  30. {{- item.content -}}
  31. {% endfor %}