Add machine_name setting type

Created on 5 September 2023, about 1 year ago
Updated 27 October 2023, about 1 year ago

Problem/Motivation

We are using textfield setting type for 2 kinds of data:

We want to constraint & validate the values set in the second use case to avoid breaking component markup.

Proposed resolution

It would be nice to add a new machine_name setting type in 2.1, alongside Add links setting type Needs review

it will be compliant with both https://www.drupal.org/node/2954832 & https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/id
It must not contain whitespace (spaces, tabs, etc.), only ASCII letters, digits, and '_' should be used, it should start with a letter.

it will be similar to TextfieldSettingType but it will leverage https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Render%21... (without checking 'exists', is it possible?)

Other tasks

This setting type is compatible with our strategy for UI Patterns 2.x

It would be a prop type with this schema:

type:string
pattern: '^[A-Za-z]+[\w\]*$'
maxLength: 64
Feature request
Status

Fixed

Component

Code

Created by

🇫🇷France pdureau Paris

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

Comments & Activities

Production build 0.71.5 2024