Add a 'field_item_utility_classes' property to the field component

Created on 4 February 2025, 2 months ago

Problem/Motivation

In field component, 'field__item' class is hardcoded

Proposed resolution

In field.twig, add

{%
  set field_item_classes = [
    'field__item',
  ]|merge(field_item_utility_classes ?: [])
%}

and change the 2 lines with
<div {{ item.attributes.addClass('field__item') }}>{{ item.content }}</div>
to
<div {{ item.attributes.addClass(field_item_classes) }}>{{ item.content }}</div>
We can then use the component like this

{%
  include "radix:field" with {
    field_item_utility_classes: ['ratio', 'ratio-16x9'],
  }
%}

Remaining tasks

1. update field.twig
2. update field.component.yml
3. update documentation

MR is coming ;-)

✨ Feature request
Status

Active

Version

6.0

Component

Code

Created by

πŸ‡«πŸ‡·France PhilY πŸ‡ͺπŸ‡ΊπŸ‡«πŸ‡· Paris, France

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024