Problem/Motivation

Part of #2120003: [META] Create sensible limits for the maximum length of configuration object filename components.

The config entity type id forms 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 type id can therefore only be a maximum of 50 characters long.

Here is an example of an config entity type id in Core using the EntityViewMode config entity.

* @ConfigEntityType(
*   id = "view_mode",
* ...
* )

Grep for all config entity types in core: ^ \* @ConfigEntityType\($

Proposed resolution

Config entity types with an ID greater than 50 characters must:

  1. Fail installation
  2. Prevent the owning module from installing as well.

This will keep contrib authors from creating config entity types with IDs greater than 50 characters and discourage adding them to D.O.

User interface changes

None.

API changes

Perhaps new methods.

Original report by @jessebeach

Comments

jessebeach’s picture