The config entity
machine_name (also called
id) property may form a part of a config entity's file name -- the yml file that represents an instance of the entity. The file name length is limited to 255 characters by most operating systems. To be safe, we limit the name to 250 characters and leave 5 for a file extension. The file name is potentially composed of 5 pieces. Each part may therefore only consume 20% of the available characters, so the config entity
machine_name can therefore only be a maximum of 50 characters long.
Here is an example of an config entity
machine_name in Core using the
entity.view_mode.node.teaser.yml config entity.
id: node.teaser label: Teaser status: true cache: true targetEntityType: node
We need to look at imposing limits at install, import and the through the UI. Machine names for config entities are often created through forms.
Config entities with a
machine_name greater than 50 characters must:
- Fail installation
- Prevent the owning module from installing as well.
This will keep contrib authors from creating config entity types with config_prefix greater than 50 characters and discourage adding them to D.O.
When creating a config entity, such as a field or a content type, through a form with a
machine_name candidate greater than 50 characters, the form must:
- Fail validation
- Inform the user that the machine_name must be short than 50 characters.
Some config entities already impose
machine_name length limits. Check for existing constants while working on this issue.
User interface changes
machine_name fields will fail validation if they contain a string greater than 50 characters.
Perhaps additional methods.
Original report by @jessebeach
PASSED: [[SimpleTest]]: [PHP 5.4 MySQL] 66,920 pass(es). View
PASSED: [[SimpleTest]]: [PHP 5.4 MySQL] 66,921 pass(es). View