Missing field classes

Created on 18 January 2024, 11 months ago

Hi Mitsuko,

To target uikit image fields with css, you need the correct field names as a classes in the html markup. But the field wrapper does not provide field classses. The wrapper is just an empty

.

Is it possible to add the normal field classes like so:
eg. field--uikit-lightbox.html.twig

{%
  set classes = [
  'field',
  'field--name-' ~ field_name|clean_class,
  'field--type-' ~ field_type|clean_class,
  'field--label-' ~ label_display,
  label_display == 'inline' ? 'clearfix',
]
%}
{% set grid_classes = [
  'uk-grid',
  'uk-flex-center',
  'uk-text-center'
  ]
%}
<div{{ attributes.addClass(classes, 'field__item') }}>
  {% if label_hidden == false %}
    <div{{ title_attributes.addClass('uk-hidden') }}>
      {{ label }}
    </div>
  {% endif %}
  <div{{ lightbox_attributes.setAttribute('data-uk-grid', 'masonry: true').addClass(grid_child_width_classes).addClass(grid_classes) }}>
    {% for item in items %}
      <div>
        {{ item.content }}
      </div>
    {% endfor %}
  </div>
</div>
🐛 Bug report
Status

Active

Version

1.9

Component

Code

Created by

🇧🇪Belgium yazzbe

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

Comments & Activities

Production build 0.71.5 2024