Add default classes for field entity-reference

Created on 10 June 2023, over 1 year ago
Updated 3 July 2023, over 1 year ago

For customize and not work (for this field) modules eg. https://www.drupal.org/project/field_formatter_class
\tara\templates\field\field--entity-reference.html.twig

 * @see template_preprocess_field()
 */
#}
{%
  set classes = [
    'field',
    'field--name-' ~ field_name|clean_class,
    'field--type-' ~ field_type|clean_class,
    'field--label-' ~ label_display,
    '' ~ 'node-taxonomy-container',
  ]
%}
{#<div class="node-taxonomy-container">#}
<div{{ attributes.addClass(classes) }}>
  {% if not label_hidden %}
🐛 Bug report
Status

Fixed

Version

10.0

Component

Code

Created by

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @promo-il
  • 🇮🇳India ravis

    Thank you for bringing this issue to my knowledge. I appreciate your efforts in alerting me to this matter.
    I have added the required classes in version 10.0.5

  • Status changed to Fixed over 1 year ago
  • 🇺🇸United States gintass

    I wonder why this class is been added - node-taxonomy-container to the field even if taxonomy is not being used or even uninstalled completely.
    Should there be some 'if' statement that would be adding these classes and and enclosing the field inside the div tag if the taxonomy is being used?
    Right now I don't have any taxonomy (I even tried uninstalling the taxonomy module completely), but the field is still being enclosed in the 'node-taxonomy-container' which has some css that makes it hard to position this field properly.
    Obviously, I can add some css to overwrite the css, but maybe that can be avoided by adding taxonomy related classes only if necessary.

Production build 0.71.5 2024