[2.0.0-beta4] MachineName prop & typed data API

Created on 27 September 2024, about 2 months ago

Problem/Motivation

MachineNamePropType has a schema inherited from Add machine_name setting type Fixed :

['type' => 'string', 'pattern' => '^[A-Za-z]+\w*$'],

Which is the intersection between:

However, we are not leveraging the constraints related to Drupal machine name data type yet: we are not using typed_data like boolean does:

#[PropType(
  id: 'boolean',
  label: new TranslatableMarkup('Boolean'),
  description: new TranslatableMarkup('Matches only two special values: true and false.'),
  default_source: 'checkbox',
  schema: ['type' => 'boolean'],
  priority: 1,
  typed_data: ['boolean']
)]

Because we didn't find any field type with a machine_name field properties in Core.

Proposed resolution

Do we add typed_data: ['machine_name'] to MachineNamePropType ?

If yes, how do we test it?

If no, is it the opportunity to drop the compatibility with Drupal machine name data type and embrace totally the HTML ID format (so, allowing - and maybe some other characters)?

📌 Task
Status

Active

Version

2.0

Component

Code

Created by

🇫🇷France pdureau Paris

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024