field--text.html.twig
Same filename in this branch
Same filename in other branches
- 9 core/profiles/demo_umami/themes/umami/templates/classy/field/field--text.html.twig
- 9 core/themes/olivero/templates/field/field--text.html.twig
- 9 core/themes/seven/templates/classy/field/field--text.html.twig
- 9 core/themes/claro/templates/classy/field/field--text.html.twig
- 9 core/themes/bartik/templates/classy/field/field--text.html.twig
- 9 core/themes/starterkit_theme/templates/field/field--text.html.twig
- 9 core/themes/classy/templates/field/field--text.html.twig
- 8.9.x core/profiles/demo_umami/themes/umami/templates/classy/field/field--text.html.twig
- 8.9.x core/themes/seven/templates/classy/field/field--text.html.twig
- 8.9.x core/themes/claro/templates/classy/field/field--text.html.twig
- 8.9.x core/themes/bartik/templates/classy/field/field--text.html.twig
- 8.9.x core/themes/classy/templates/field/field--text.html.twig
- 11.x core/profiles/demo_umami/themes/umami/templates/classy/field/field--text.html.twig
- 11.x core/themes/olivero/templates/field/field--text.html.twig
- 11.x core/themes/claro/templates/classy/field/field--text.html.twig
- 11.x core/themes/starterkit_theme/templates/field/field--text.html.twig
Theme override for a text field.
A 'clearfix' class is added, because 'text' fields have a 'format' property that allows a Text Format to be associated with the entered text, which then applies filtering on output. A common use case is to align images to the left or right, and without this 'clearfix' class, such aligned images may be rendered outside of the 'text' field formatter's boundaries, and hence overlap with other fields. By setting the 'clearfix' class on all 'text' fields, we prevent that.
See also
https://www.drupal.org/node/2358529
File
-
core/
themes/ olivero/ templates/ field/ field--text.html.twig
View source
- {% extends "field.html.twig" %}
- {#
- /**
- * @file
- * Theme override for a text field.
- *
- * A 'clearfix' class is added, because 'text' fields have a 'format' property
- * that allows a Text Format to be associated with the entered text, which then
- * applies filtering on output. A common use case is to align images to the left
- * or right, and without this 'clearfix' class, such aligned images may be
- * rendered outside of the 'text' field formatter's boundaries, and hence
- * overlap with other fields. By setting the 'clearfix' class on all 'text'
- * fields, we prevent that.
- *
- * @see https://www.drupal.org/node/2358529
- *
- * @ingroup themeable
- */
- #}
- {% set attributes = attributes.addClass('clearfix') %}
Related topics
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.