Skip to content

[#3537620] feat(Theme builder): Allow defining values and labels for List props

Closes #3537620

I've found some issues in 1.x. Raising separate issues for them

  1. Can't create a prop of type "List: Text" if one of the enum value's has a . in it (e.g. Foo.). You get the error The "meta:enum" keys for the "num" prop enum cannot contain a dot. Offending key: "Foo." when trying to publish. This means you can't use a float (e.g if you wanted to control CSS opacity) or, for another example, any sentence with a full stop at the end. https://www.drupal.org/project/canvas/issues/3553605
  2. If you set a prop to "Formatted text" before changing it to anything else, it gets "stuck" as "Formatted text": Follow up https://www.drupal.org/project/canvas/issues/3553361

Now on to what this MR does

  1. In the serialize and deserialize functions for the props we convert the meta:enum format that the backend uses to a more easy to use format for the form UI.
  2. The UI now has inputs for both the Value and the Label.
  3. When entering a value, the label is generated automatically.
  4. Once the label has been edited manually, or if the label was already present when the form was loaded, the "link" is broken and the label no longer updates automatically
  5. I added a validation state to warn the user if they have duplicate values in the same list.
Edited by Jesse Baker

Merge request reports

Loading