Create a field SDC and use it in the field.html.twig

Created on 29 July 2025, 2 days ago

Problem/Motivation

Overriding the Fences field template is kind of clunky because of the variables for wrappers, etc.
Having an SDC would be much more convenient.

{%
  include 'fences:field' with {
    field_items: items,
    field_label: label,
    display_field_tag : true,
    display_label_tag: true,
    display_items_wrapper_tag: true,
    display_item_tag: true,
    field_tag: 'div',
    field_items_wrapper_tag: 'div',
    field_label_tag: 'h2',
    field_item_tag: 'div',
    field_utility_classes: [],
    field_label_utility_classes: [],
    field_items_wrapper_utility_classes: [],
    field_item_utility_classes: [],
  }
%}

However, adding this to the field.html.twig would be a breaking change.

Ideally, I would like this to be optional, either as a setting or a submodule.
What do you think?

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Feature request
Status

Active

Version

3.0

Component

Code (fences)

Created by

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

Comments & Activities

Production build 0.71.5 2024