Unlock default patterns

Created on 17 September 2018, over 6 years ago
Updated 3 December 2024, 19 days ago

The user should be able to customize all patterns, including those that come with the module. Yet we must give third-party module developers the confidence that the patterns they use will be available.

To do that, we should allow per-field patterns. Something like this:

$form['ip'] = [
  '#type' => 'textfield',
  '#title' => t('IP address'),
  '#mask' => [
    'value' => '099.099.099.099',
    'reverse' => FALSE,
    'selectonfocus' => FALSE,
    'clearifnotmatch' => TRUE,
    'translation' => [
      '0' => [
        'pattern' => '\d',
      ],
      '9' => [
        'pattern' => '\d',
        'optional' => TRUE,
      ],
    ],
  ],
];

These settings would overwrite the module's global settings for that field.

However, having to write all these translation patterns every time is tedious. So we should provide some method to provide the translation patterns just once per module.

Feature request
Status

Active

Version

2.1

Component

Code

Created by

🇧🇷Brazil dbiscalchin

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024