/Drupal 8

public function ConfigEntityType::getConfigPrefix

public ConfigEntityType::getConfigPrefix()

Gets the config prefix used by the configuration entity type.

The config prefix is used to prefix configuration entity IDs when they are stored in the configuration system. The default config prefix is constructed from the name of the module that provides the entity type and the ID of the entity type. If a config_prefix annotation is present it will be used in place of the entity type ID.

Prefixing with the module that provides the configuration entity type ensures that configuration entities depend on the module that provides the configuration entity type.

Return value

string The config prefix.


\Drupal\Core\Config\ConfigPrefixLengthException Exception thrown when the length of the prefix exceeds PREFIX_LENGTH.

Overrides ConfigEntityTypeInterface::getConfigPrefix


core/lib/Drupal/Core/Config/Entity/ConfigEntityType.php, line 76


Provides an implementation of a configuration entity type and its metadata.




public function getConfigPrefix() {
  // Ensure that all configuration entities are prefixed by the name of the
  // module that provides the configuration entity type.
  if (isset($this->config_prefix)) {
    $config_prefix = $this->provider . '.' . $this->config_prefix;
  else {
    $config_prefix = $this->provider . '.' . $this->id();

  if (strlen($config_prefix) > static::PREFIX_LENGTH) {
    throw new ConfigPrefixLengthException("The configuration file name prefix $config_prefix exceeds the maximum character limit of " . static::PREFIX_LENGTH);
  return $config_prefix;

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.