field.html.twig 717 B

1234567891011121314151617181920
  1. {% extends "@stable/field/field.html.twig" %}
  2. {# Create classes array #}
  3. {% set classes = [] %}
  4. {# BEM inspired class syntax: https://en.bem.info/
  5. Enable this code if you would like field classes like "article__tags", where article is the content type and field_tags is the field name.
  6. #}
  7. {% set classes = classes|merge([
  8. bundle ~ '__' ~ field_name|replace({'field_' : ''})|clean_class
  9. ]) %}
  10. {% set attributes = attributes.addClass(classes) %}
  11. {#
  12. Ensures that the visually hidden option for field labels works correctly.
  13. @todo: Remove when https://www.drupal.org/node/2779919 is resolved.
  14. #}
  15. {% set title_attributes = title_attributes.addClass(label_display == 'visually_hidden' ? 'visually-hidden') %}