Token (& token type) machine name requirements

Created on 8 November 2019, about 5 years ago
Updated 27 October 2023, about 1 year ago

Background:
The description under machine name for a custom token says "A unique machine-readable name for this token. It must only contain lowercase letters, numbers, and underscores." This is properly enforced, underscores work, hyphens do not.

The description under machine name for a custom token TYPE says "A unique machine-readable name for this token. It must only contain lowercase letters, numbers, and underscores." But the if you use an underscore you get an error which says "The machine-readable name must contain only lowercase letters, numbers, and hyphens." Hyphens work, underscores do not.

Proposed solution(s)
1) Preferred: make the two consistent with the rest of drupal by using the machine name element that is included in drupal core (https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Render%21...).

Alternatives 2) make the two consistent within code so that they both allow hyphens and/or both allow underscores and make the descriptions accurate.

Alternative 3) make the descriptions accurate.

πŸ› Bug report
Status

RTBC

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States kwfinken Lansing, MI

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

Merge Requests

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