- last update
8 months ago Custom Commands Failed - last update
8 months ago 28,534 pass, 6 fail - Merge request !7417Resolve #3308309 "Simplify html of field.html.twig" → (Open) created by kostask
- 🇮🇪Ireland markconroy
At DrupalCon Prague we decided that field--has-multiple-items and field--has-single-item were not communicating the correct information. We need to communicate the field cardinality in the database. When a user sees has-multiple or has-single they will connect this information what is rendered. A multivalue field can have just one entry, but in the original patch it would get a has-multiple-items class.
Just for clarity, the way
field.html.twig
currently works is that if it's a multivalue field - even if it only has one item in it - it gets the.field__items
wrapper. If it has only one item, that item is wrapped in adiv
and if it has more than one item it usesul
.The class we are intending to add here
field--multiple
will denote that this is a multivalue field, not how many items are in the field.
Perhaps we could add another classfield--has-N-items
to denote how many items we actually have.Suggestion for classes:
'field--name-' ~ field_name|clean_class, 'field--type-' ~ field_type|clean_class, 'field--label-' ~ label_display, multiple ? 'field--multivalue-field' : 'field--single-value-field', multiple ? 'field--has' ~ items|length ~ 'items'|clean_class : 'field--has-1-item', label_display == 'inline' ? 'clearfix',
Note: we will need to update the issue summary with new notes for the change record.