ConfigEntityTypeInterface::PREFIX_LENGTH

Length limit of the configuration entity prefix.

Configuration entity names are composed of two parts:

  • The config prefix, which is returned by getConfigPrefix() and is composed of:
    • The provider module name (limited to 50 characters by DRUPAL_EXTENSION_NAME_MAX_LENGTH).
    • The module-specific namespace identifier, which defaults to the configuration entity type ID. Entity type IDs are limited to 32 characters by EntityTypeInterface::ID_MAX_LENGTH.
  • The configuration entity ID.

So, a typical configuration entity filename will look something like: provider_module_name.namespace_identifier.config_entity_id.yml

Most file systems limit a file name's length to 255 characters, so ConfigBase::MAX_NAME_LENGTH restricts the full configuration object name to 250 characters (leaving 5 for the file extension). Therefore, in order to leave sufficient characters to construct a configuration ID, the configuration entity prefix is limited to 83 characters: up to 50 characters for the module name, 1 for the dot, and 32 for the namespace identifier. This also allows modules with shorter names to define longer namespace identifiers if desired.

See also

\Drupal\Core\Config\ConfigBase::MAX_NAME_LENGTH

\Drupal\Core\Config\Entity\ConfigEntityTypeInterface::getConfigPrefix()

DRUPAL_EXTENSION_NAME_MAX_LENGTH

\Drupal\Core\Config\Entity\ConfigEntityStorage::MAX_ID_LENGTH

\Drupal\Core\Entity\EntityTypeInterface::ID_MAX_LENGTH

File

core/lib/Drupal/Core/Config/Entity/ConfigEntityTypeInterface.php, line 42

Class

ConfigEntityTypeInterface
Provides an interface for a configuration entity type and its metadata.

Namespace

Drupal\Core\Config\Entity

Code

const PREFIX_LENGTH = 83;
doc_Drupal
2016-10-29 08:53:09
Comments
Leave a Comment

Please login to continue.