Allow to choose another field to define the wrapper tag

Created on 13 June 2025, about 1 month ago

Problem/Motivation

Thanks for the amazing module. Saved me a lot of time as I had something similar to do.
I would like to provide a feature request as to have another field manage the wrapper tag. This is something that happens a lot when defining a heading for example.

Steps to reproduce

N/A

Proposed resolution

Provide an option to select a field that will define the wrapper tag. The field needs to be a list_string field and should be validated that its a valid html tag.

Remaining tasks

Review MR

User interface changes

It will allow the site builder to select a field that will provide the wrapper tag.

API changes

None.

Data model changes

Extra option other field.

Feature request
Status

Active

Version

2.0

Component

Code

Created by

🇧🇪Belgium tim-diels Belgium 🇧🇪

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

Merge Requests

Comments & Activities

  • Issue created by @tim-diels
  • 🇧🇪Belgium tim-diels Belgium 🇧🇪
  • Merge request !8Provide the option 'Other field' → (Open) created by tim-diels
  • 🇧🇪Belgium tim-diels Belgium 🇧🇪
  • 🇦🇺Australia jannakha Brisbane!

    applied patch to D11, it seems to work, but it's very unintuitive how to use it.
    maybe add description to "Field wrapper - Other field" what kind of field it should be, eg "list_string field and should be validated that its a valid html tag."

    also, maybe it should be a separate field formatter which extends TextFieldFormatter not to add too much complexity and clutter to the code ?

    #[FieldFormatter(
      id: 'text_field_wrap_formatter',
      label: new TranslatableMarkup('Text field formatter with wrap field'),
      field_types: [
        'string',
      ],
    )]
    class TextFieldWrapFormatter extends TextFieldFormatter {
    ...
    }

    (MR8 doubles complexity of the code).

Production build 0.71.5 2024