Menu & routing docs ambiguous on machine name requirements; is "machine name" documented anywhere?

Created on 9 September 2016, over 8 years ago
Updated 5 February 2025, about 2 months ago

Problem/Motivation

The examples in the API documentation for the menu system say that the "machine name" for e.g. a local action should match that for the route. However:

  1. The API documentation in question doesn't explain what "machine name" means, or is used for, nor do they link to a standard explanation.
  2. It also doesn't explain why e.g. the menu action machine name should be the same as the route name, and what the consequences are if they're not the same (even if it's "a human reading the YAML might get confused or lose track.")
  3. The Routing documentation linked to doesn't explain what "machine name" is either.
  4. The Coding standards β†’ don't seem to even mention machine names. If they're discussed in a subpage of the coding standards, it isn't obvious which one (e.g. they're not on Services and extending Symfony β†’ .)

Proposed resolution

The API documentation as a whole needs to make clear what "machine name" means, either: with reference other API documentation or a coding standard; or by writing new documentation to clarify.

The API documentation for the menu and routing components (and any other relevant components) needs to make clear why e.g. local action machine names should match route names, and what the consequences are if they don't

Remaining tasks

  1. Either find existing documentation on "machine name", or:
    1. Agree on what is and is not a machine name (allowed characters, namespacing, uniqueness etc.)
    2. Turn that agreement into something easy to read and find a place for it either in Drupal core or on d.o e.g. in the coding standards.
  2. Link to this documentation from Drupal Core's API documentation wherever "machine name" is used (menu, routing - and anywhere else.)
  3. Explain in the menu documentation in Drupal Core why e.g. local action machine names must not only conform to the standard for "machine name", but should also match the route name; and explain what happens if they don't match, if anything.

User interface changes

None.

API changes

None.

Data model changes

None.

✨ Feature request
Status

Active

Version

11.0 πŸ”₯

Component

documentation

Created by

πŸ‡¬πŸ‡§United Kingdom jp.stacey

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