Expose general constraints to the form elements

Created on 15 April 2025, 9 days ago

Problem/Motivation

Schemas can define constraints applied to the specific fields, like this (from the "system.schema.yml"):

  mapping:
      type: uuid
      label: 'Site UUID'
      constraints:
        Uuid: []
        NotNull: []
    id:
      type: machine_name
      label: 'ID'
      constraints:
        Regex:
          pattern: '/^[a-z0-9-]+$/'
          message: "The %value machine name is not valid."
        Length:
          max: 32
    error_level:
      type: string
      label: 'Error messages to display'
      constraints:
        Choice:
          choices:
            - 'hide'
            - 'some'
            - 'all'
            - 'verbose'
    type:
      type: string
      label: 'Type'
      nullable: true
      constraints:
        NotBlank:
          allowNull: true

They are checked automatically on the config save, but would be good to expose some of them to the form. At least, NotNull, NotBlank, Length, Range.

Proposed resolution

Add checking for constraints and map them to the form elements.

✨ Feature request
Status

Active

Version

1.0

Component

Code

Created by

πŸ‡¦πŸ‡²Armenia murz Yerevan, Armenia

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