Updated: Comment #1
Problem/Motivation
#1701014: Validate config object names limits the maximum file name length of a configuration object name to 250 characters.
Now we need to prevent situations where the individual parts of the configuration object filename (plus the periods that separate them) do exceed 250 characters.
The name of a file that contains the details for a configuration entity is composed of 3 parts.
$extension.$identifier.$machine_name
The $machine_name
may itself be comprised of components; this complexity is determined by the config entity class that produces the machine name.
Here is the fully-expanded set of possibilities.
|------> Machine name - defined by config entity type
{extension}.{identifier}.{target entity type}.{target entity bundle}.{instance name}
In Core, we find these combinations:
{extension}.{identifier}.{target entity type}.{instance name}
{extension}.{identifier}.{target entity type}.{target entity bundle}.{instance name}
{extension}.{identifier}.{target entity type}.{target entity bundle}
{extension}.{identifier}.{instance name}
In order to maintain file names that are less than 255 characters, we need to limit the length of the components of the file name, so given the template
$extension.$identifier.$machine_name
we need to establish the following char length limits on each part:
50.32.128
Listed below is a complete set of examples for each config entity entity in core.
EntityViewMode, EntityFormMode and FieldConfig File Name Components
Config Entity Type | api provider | entity type ID | target entity type | -- | instance name |
---|---|---|---|---|---|
view_mode | entity | .view_mode | .node | -- | .search_result |
form_mode | entity | .form_mode | .user | -- | .register |
field_config | field | .field | .node | -- | .body |
EntityViewDisplay, EntityFormDisplay and FieldInstanceConfig File Name Components
Config Entity Type | api provider | entity type ID | target entity type | target entity bundle | instance name |
---|---|---|---|---|---|
entity_view_display | entity | .view_display | .node | .article | .teaser |
entity_form_display | entity | .form_display | .node | .article | .default |
field_instance_config | field | .instance | .node | .article | .body |
RdfMapping File Name Components
Config Entity Type | api provider | config_prefix | target entity type | target entity bundle | -- |
---|---|---|---|---|---|
rdf_mapping | rdf | .mapping | .comment | .node__comment | -- |
All other Configuration entities File Name Components
Config Entity Type | api provider | config_prefix | -- | -- | machine_name |
---|---|---|---|---|---|
node_type | node | .type | -- | -- | .article |
custom_block_type | custom_block | .type | -- | -- | .basic |
search_page | search | .page | -- | -- | .node_search |
user_role | user | .role | -- | -- | .anonymous |
block | block | .block | -- | -- | .bartik_content |
filter_format | filter | .format | -- | -- | .full_html |
image_style | image | .style | -- | -- | .large |
contact_category | contact | .category | -- | -- | .feedback |
editor | editor | .editor | -- | -- | .basic_html |
breakpoint | breakpoint | .breakpoint | -- | -- | .theme.bartik.mobile |
breakpoint_group | breakpoint | .breakpoint_group | -- | -- | .theme.bartik.bartik |
language_entity | language | .entity | -- | -- | .en |
responsive_image_mapping | responsive_image | .mappings | -- | -- | .someName |
shortcut_set | shortcut | .set | -- | -- | .default |
action | system | .action | -- | -- | .node_unpublish_action |
date_format | system | .date_format | -- | -- | .html_date |
menu | system | .menu | -- | -- | .main |
taxonomy_vocabulary | taxonomy | .vocabulary | -- | -- | .tags |
tour | tour | .tour | -- | -- | .views_ui |
view | views | .view | -- | -- | .frontpage |
The combination of these parts cannot exceed 250 characters. If they did, a site could break during upgrade, when a module is enabled, when configuration is imported, and various other scenarios.
Note: original discussion related to this problem occurred in #1186034: Length of configuration object name can be too small
The longest configuration name (found so far) in core is:
entity.view_display.node.12345678901234567890123456789012.1234567890123456789012345678901234567890123456789012345678901234
It's 122 characters long. This consists of provider ("node"), entity type ID ("view_display"), target entity type ("node"), target entity type bundle ("12345678901234567890123456789012") and display mode machine name ("1234567890123456789012345678901234567890123456789012345678901234").
In addition, language-specific configuration prefixes information to the existing configuration object file name, potentially making it too long. That issue is tracked here #2201437: [META-1] Config overrides and language.
Remaining tasks
Each part of a configuration object file name will get its own issue. Some parts are already length-limited.
Part | Issue |
---|---|
api provider | #1852454: Restrict module and theme name lengths to 50 characters |
entity type ID/config_prefix | #1862600: Entity type names/IDs are not properly namespaced by owner (e.g., taxonomy.term vs. taxonomy_term) |
entity type/entity bundle | #1709960: declare a maximum length for entity and bundle machine names |
config entity machine name | #2220757: Limit length of Config::$id to something <= 166 characters |
composed config file name | #1701014: Validate config object names |
Additionally, we must determine how to migrate Drupal 7 data that exceeds these limits.
User interface changes
Certain admin UIs should indicated a maximum character limit. (Needs issues.)
API changes
Potentially
Related Issues
- #1852896: Throw an exception if a schema defines a key that would be over 1000 bytes in MySQL
- #2100203: Make config entities use dots in machine names consistently
- To be filed? The config entity prefix should only consist of the current domain-specific second half (e.g. "instance") and the owner module (e.g. "field") should be enforced in validation as the first part of the object name.