Issue #2482215 by alexpott: Improve config_prefix documentation

8.0.x
Jennifer Hodgdon 2015-05-11 14:58:17 -07:00
parent 797f9d2d76
commit ff62d88889
2 changed files with 16 additions and 18 deletions

View File

@ -20,12 +20,7 @@ class ConfigEntityType extends EntityType implements ConfigEntityTypeInterface {
/** /**
* The config prefix set in the configuration entity type annotation. * The config prefix set in the configuration entity type annotation.
* *
* The default configuration prefix is constructed from the name of the module * @see \Drupal\Core\Config\Entity\ConfigEntityTypeInterface::getConfigPrefix()
* 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.
*
* @see \Drupal\Core\Config\Entity\ConfigEntityType::getConfigPrefix()
*/ */
protected $config_prefix; protected $config_prefix;
@ -89,10 +84,7 @@ class ConfigEntityType extends EntityType implements ConfigEntityTypeInterface {
*/ */
public function getConfigPrefix() { public function getConfigPrefix() {
// Ensure that all configuration entities are prefixed by the name of the // Ensure that all configuration entities are prefixed by the name of the
// module that provides the configuration entity type. This ensures that // module that provides the configuration entity type.
// default configuration will be created as expected during module
// installation and dependencies can be calculated without the modules that
// provide the entity types being installed.
if (isset($this->config_prefix)) { if (isset($this->config_prefix)) {
$config_prefix = $this->provider . '.' . $this->config_prefix; $config_prefix = $this->provider . '.' . $this->config_prefix;
} }

View File

@ -49,15 +49,21 @@ interface ConfigEntityTypeInterface extends EntityTypeInterface {
/** /**
* Gets the config prefix used by the configuration entity type. * Gets the config prefix used by the configuration entity type.
* *
* Ensures that all configuration entities are prefixed by the module that * The config prefix is used to prefix configuration entity IDs when they are
* provides the configuration entity type. This ensures that if a * stored in the configuration system. The default config prefix is
* configuration entity is contained in a extension's default configuration, * constructed from the name of the module that provides the entity type and
* it will be created during extension installation. Additionally, it allows * the ID of the entity type. If a config_prefix annotation is present it will
* dependencies to be calculated without the modules that provide * be used in place of the entity type ID.
* configuration entity types being installed.
* *
* @return string|bool * Prefixing with the module that provides the configuration entity type
* The config prefix, or FALSE if not a configuration entity type. * ensures that configuration entities depend on the module that provides the
* configuration entity type.
*
* @return string
* The config prefix.
*
* @throws \Drupal\Core\Config\ConfigPrefixLengthException
* Exception thrown when the length of the prefix exceeds PREFIX_LENGTH.
*/ */
public function getConfigPrefix(); public function getConfigPrefix();