class ConfigEntityType in Zircon Profile 8.0
Same name in this branch
- 8.0 core/lib/Drupal/Core/Config/Entity/ConfigEntityType.php \Drupal\Core\Config\Entity\ConfigEntityType
- 8.0 core/lib/Drupal/Core/Entity/Annotation/ConfigEntityType.php \Drupal\Core\Entity\Annotation\ConfigEntityType
Same name and namespace in other branches
- 8 core/lib/Drupal/Core/Config/Entity/ConfigEntityType.php \Drupal\Core\Config\Entity\ConfigEntityType
Provides an implementation of a configuration entity type and its metadata.
Hierarchy
- class \Drupal\Core\Entity\EntityType implements EntityTypeInterface uses StringTranslationTrait
- class \Drupal\Core\Config\Entity\ConfigEntityType implements ConfigEntityTypeInterface
Expanded class hierarchy of ConfigEntityType
2 files declare their use of ConfigEntityType
- ConfigEntityTypeTest.php in core/
tests/ Drupal/ Tests/ Core/ Config/ Entity/ ConfigEntityTypeTest.php - Contains \Drupal\Tests\Core\Config\Entity\ConfigEntityTypeTest.
- EntityViewsDataTest.php in core/
modules/ views/ tests/ src/ Unit/ EntityViewsDataTest.php - Contains \Drupal\Tests\views\Unit\EntityViewsDataTest.
File
- core/
lib/ Drupal/ Core/ Config/ Entity/ ConfigEntityType.php, line 17 - Contains \Drupal\Core\Config\Entity\ConfigEntityType.
Namespace
Drupal\Core\Config\EntityView source
class ConfigEntityType extends EntityType implements ConfigEntityTypeInterface {
/**
* The config prefix set in the configuration entity type annotation.
*
* @see \Drupal\Core\Config\Entity\ConfigEntityTypeInterface::getConfigPrefix()
*/
protected $config_prefix;
/**
* {@inheritdoc}
*/
protected $static_cache = FALSE;
/**
* Keys that are stored key value store for fast lookup.
*
* @var array
*/
protected $lookup_keys = [];
/**
* The list of configuration entity properties to export from the annotation.
*
* @var array
*/
protected $config_export = [];
/**
* The result of merging config_export annotation with the defaults.
*
* This is stored on the class so that it does not have to be recalculated.
*
* @var array
*/
protected $mergedConfigExport = [];
/**
* {@inheritdoc}
*
* @throws \Drupal\Core\Config\Entity\Exception\ConfigEntityStorageClassException
* Exception thrown when the provided class is not an instance of
* \Drupal\Core\Config\Entity\ConfigEntityStorage.
*/
public function __construct($definition) {
// Ensure a default list cache tag is set; do this before calling the parent
// constructor, because we want "Configuration System style" cache tags.
if (empty($this->list_cache_tags)) {
$this->list_cache_tags = [
'config:' . $definition['id'] . '_list',
];
}
parent::__construct($definition);
// Always add a default 'uuid' key.
$this->entity_keys['uuid'] = 'uuid';
$this->entity_keys['langcode'] = 'langcode';
$this->handlers += array(
'storage' => 'Drupal\\Core\\Config\\Entity\\ConfigEntityStorage',
);
$this->lookup_keys[] = 'uuid';
}
/**
* {@inheritdoc}
*/
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;
}
/**
* {@inheritdoc}
*/
public function getBaseTable() {
return FALSE;
}
/**
* {@inheritdoc}
*/
public function getRevisionDataTable() {
return FALSE;
}
/**
* {@inheritdoc}
*/
public function getRevisionTable() {
return FALSE;
}
/**
* {@inheritdoc}
*/
public function getDataTable() {
return FALSE;
}
/**
* {@inheritdoc}
*/
public function getConfigDependencyKey() {
return 'config';
}
/**
* {@inheritdoc}
*
* @see \Drupal\Core\Config\Entity\ConfigEntityStorage.
*
* @throws \Drupal\Core\Config\Entity\Exception\ConfigEntityStorageClassException
* Exception thrown when the provided class is not an instance of
* \Drupal\Core\Config\Entity\ConfigEntityStorage.
*/
protected function checkStorageClass($class) {
if (!is_a($class, 'Drupal\\Core\\Config\\Entity\\ConfigEntityStorage', TRUE)) {
throw new ConfigEntityStorageClassException("{$class} is not \\Drupal\\Core\\Config\\Entity\\ConfigEntityStorage or it does not extend it");
}
}
/**
* {@inheritdoc}
*/
public function getPropertiesToExport() {
if (!empty($this->config_export)) {
if (empty($this->mergedConfigExport)) {
// Always add default properties to be exported.
$this->mergedConfigExport = [
'uuid' => 'uuid',
'langcode' => 'langcode',
'status' => 'status',
'dependencies' => 'dependencies',
'third_party_settings' => 'third_party_settings',
];
foreach ($this->config_export as $property => $name) {
if (is_numeric($property)) {
$this->mergedConfigExport[$name] = $name;
}
else {
$this->mergedConfigExport[$property] = $name;
}
}
}
return $this->mergedConfigExport;
}
return NULL;
}
/**
* {@inheritdoc}
*/
public function getLookupKeys() {
return $this->lookup_keys;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
ConfigEntityType:: |
protected | property | The list of configuration entity properties to export from the annotation. | |
ConfigEntityType:: |
protected | property | The config prefix set in the configuration entity type annotation. | |
ConfigEntityType:: |
protected | property | Keys that are stored key value store for fast lookup. | |
ConfigEntityType:: |
protected | property | The result of merging config_export annotation with the defaults. | |
ConfigEntityType:: |
protected | property |
Indicates whether entities should be statically cached. Overrides EntityType:: |
|
ConfigEntityType:: |
protected | function |
Overrides EntityType:: |
|
ConfigEntityType:: |
public | function |
Gets the name of the entity's base table. Overrides EntityType:: |
|
ConfigEntityType:: |
public | function |
Gets the key that is used to store configuration dependencies. Overrides EntityType:: |
|
ConfigEntityType:: |
public | function |
Gets the config prefix used by the configuration entity type. Overrides ConfigEntityTypeInterface:: |
|
ConfigEntityType:: |
public | function |
Gets the name of the entity's data table. Overrides EntityType:: |
|
ConfigEntityType:: |
public | function |
Gets the keys that are available for fast lookup. Overrides ConfigEntityTypeInterface:: |
|
ConfigEntityType:: |
public | function |
Gets the config entity properties to export if declared on the annotation. Overrides ConfigEntityTypeInterface:: |
|
ConfigEntityType:: |
public | function |
Gets the name of the entity's revision data table. Overrides EntityType:: |
|
ConfigEntityType:: |
public | function |
Gets the name of the entity's revision table. Overrides EntityType:: |
|
ConfigEntityType:: |
public | function |
Overrides EntityType:: |
|
ConfigEntityTypeInterface:: |
constant | Length limit of the configuration entity prefix. | ||
EntityType:: |
protected | property | Any additional properties and values. | |
EntityType:: |
protected | property | The name of the default administrative permission. | |
EntityType:: |
protected | property | The name of the entity type's base table. | |
EntityType:: |
protected | property | The name of the entity type which provides bundles. | |
EntityType:: |
protected | property | The human-readable name of the entity bundles, e.g. Vocabulary. | |
EntityType:: |
protected | property | The name of the entity type for which bundles are provided. | |
EntityType:: |
protected | property | The name of the entity type class. | |
EntityType:: |
protected | property | Indicates whether this entity type is commonly used as a reference target. | |
EntityType:: |
protected | property | Entity constraint definitions. | |
EntityType:: |
protected | property | The name of the entity type's data table. | |
EntityType:: |
protected | property | An array of entity keys. | |
EntityType:: |
protected | property | The route name used by field UI to attach its management pages. | |
EntityType:: |
protected | property | The machine name of the entity type group. | |
EntityType:: |
protected | property | The human-readable name of the entity type group. | |
EntityType:: |
protected | property | An array of handlers. | |
EntityType:: |
protected | property | The unique identifier of this entity type. | |
EntityType:: |
protected | property | The human-readable name of the type. | |
EntityType:: |
protected | property | The name of a callback that returns the label of the entity. | |
EntityType:: |
protected | property | Link templates using the URI template syntax. | |
EntityType:: |
protected | property | The list cache contexts for this entity type. | |
EntityType:: |
protected | property | The list cache tags for this entity type. | |
EntityType:: |
protected | property | The name of the original entity type class. | |
EntityType:: |
protected | property | The permission granularity level. | |
EntityType:: |
protected | property | Indicates if the persistent cache of field data should be used. | |
EntityType:: |
protected | property | The name of the provider of this entity type. | |
EntityType:: |
protected | property | Indicates whether the rendered output of entities should be cached. | |
EntityType:: |
protected | property | The name of the entity type's revision data table. | |
EntityType:: |
protected | property | The name of the entity type's revision table. | |
EntityType:: |
protected | property | Indicates whether entities of this type have multilingual support. | |
EntityType:: |
protected | property | A callable that can be used to provide the entity URI. | |
EntityType:: |
public | function |
Adds a validation constraint. Overrides EntityTypeInterface:: |
|
EntityType:: |
public | function |
Gets any arbitrary property. Overrides EntityTypeInterface:: |
|
EntityType:: |
public | function |
Gets the access control class. Overrides EntityTypeInterface:: |
|
EntityType:: |
public | function |
Gets the name of the default administrative permission. Overrides EntityTypeInterface:: |
|
EntityType:: |
public | function |
Gets the config dependency info for this entity, if any exists. Overrides EntityTypeInterface:: |
|
EntityType:: |
public | function |
Gets the name of the entity type which provides bundles. Overrides EntityTypeInterface:: |
|
EntityType:: |
public | function |
Gets the label for the bundle. Overrides EntityTypeInterface:: |
|
EntityType:: |
public | function |
Gets the entity type for which this entity provides bundles. Overrides EntityTypeInterface:: |
|
EntityType:: |
public | function |
Gets the class. Overrides PluginDefinitionInterface:: |
|
EntityType:: |
public | function |
Gets an array of validation constraints. Overrides EntityTypeInterface:: |
|
EntityType:: |
public | function |
Gets the form class for a specific operation. Overrides EntityTypeInterface:: |
|
EntityType:: |
public | function |
Gets the machine name of the entity type group. Overrides EntityTypeInterface:: |
|
EntityType:: |
public | function |
Gets the human-readable name of the entity type group. Overrides EntityTypeInterface:: |
|
EntityType:: |
public | function |
Overrides EntityTypeInterface:: |
|
EntityType:: |
public | function |
Gets an array of handlers. Overrides EntityTypeInterface:: |
|
EntityType:: |
public | function |
Gets a specific entity key. Overrides EntityTypeInterface:: |
|
EntityType:: |
public | function |
Gets an array of entity keys. Overrides EntityTypeInterface:: |
|
EntityType:: |
public | function |
Gets the human-readable name of the entity type. Overrides EntityTypeInterface:: |
|
EntityType:: |
public | function |
Gets the callback for the label of the entity. Overrides EntityTypeInterface:: |
|
EntityType:: |
public | function |
Gets the link template for a given key. Overrides EntityTypeInterface:: |
|
EntityType:: |
public | function |
Gets the link templates using the URI template syntax. Overrides EntityTypeInterface:: |
|
EntityType:: |
public | function |
Gets the list class. Overrides EntityTypeInterface:: |
|
EntityType:: |
public | function |
The list cache contexts associated with this entity type. Overrides EntityTypeInterface:: |
|
EntityType:: |
public | function |
The list cache tags associated with this entity type. Overrides EntityTypeInterface:: |
|
EntityType:: |
public | function |
Gets the lowercase form of the human-readable entity type name. Overrides EntityTypeInterface:: |
|
EntityType:: |
public | function |
Gets the name of the original entity type class. Overrides EntityTypeInterface:: |
|
EntityType:: |
public | function |
Gets the permission granularity level. Overrides EntityTypeInterface:: |
|
EntityType:: |
public | function |
Gets the name of the provider of this entity type. Overrides EntityTypeInterface:: |
|
EntityType:: |
public | function |
Gets all the route provide handlers. Overrides EntityTypeInterface:: |
|
EntityType:: |
public | function |
Gets the storage class. Overrides EntityTypeInterface:: |
|
EntityType:: |
public | function |
Gets a callable that can be used to provide the entity URI. Overrides EntityTypeInterface:: |
|
EntityType:: |
public | function |
Gets the view builder class. Overrides EntityTypeInterface:: |
|
EntityType:: |
public | function |
Indicates if this entity type has any forms. Overrides EntityTypeInterface:: |
|
EntityType:: |
public | function |
Determines if there is a handler for a given type. Overrides EntityTypeInterface:: |
|
EntityType:: |
public | function |
Indicates if a given entity key exists. Overrides EntityTypeInterface:: |
|
EntityType:: |
public | function |
Indicates if a label callback exists. Overrides EntityTypeInterface:: |
|
EntityType:: |
public | function |
Indicates if a link template exists for a given key. Overrides EntityTypeInterface:: |
|
EntityType:: |
public | function |
Indicates if this entity type has a list class. Overrides EntityTypeInterface:: |
|
EntityType:: |
public | function |
Indicates if this entity type has any route provider. Overrides EntityTypeInterface:: |
|
EntityType:: |
public | function |
Indicates if this entity type has a view builder. Overrides EntityTypeInterface:: |
|
EntityType:: |
public | function |
Gets the unique identifier of the entity type. Overrides EntityTypeInterface:: |
|
EntityType:: |
public | function |
Indicates whether this entity type is commonly used as a reference target. Overrides EntityTypeInterface:: |
|
EntityType:: |
public | function |
Indicates if the persistent cache of field data should be used. Overrides EntityTypeInterface:: |
|
EntityType:: |
public | function |
Indicates whether the rendered output of entities should be cached. Overrides EntityTypeInterface:: |
|
EntityType:: |
public | function |
Indicates whether entities of this type have revision support. Overrides EntityTypeInterface:: |
|
EntityType:: |
public | function |
Indicates whether entities should be statically cached. Overrides EntityTypeInterface:: |
|
EntityType:: |
public | function |
Indicates if the entity type is a subclass of the given class or interface. Overrides EntityTypeInterface:: |
|
EntityType:: |
public | function |
Indicates whether entities of this type have multilingual support. Overrides EntityTypeInterface:: |
|
EntityType:: |
public | function |
Sets a value to an arbitrary property. Overrides EntityTypeInterface:: |
|
EntityType:: |
public | function |
Gets the access class. Overrides EntityTypeInterface:: |
|
EntityType:: |
public | function |
Sets the class. Overrides PluginDefinitionInterface:: |
|
EntityType:: |
public | function |
Sets the array of validation constraints for the FieldItemList. Overrides EntityTypeInterface:: |
|
EntityType:: |
public | function |
Sets a form class for a specific operation. Overrides EntityTypeInterface:: |
|
EntityType:: |
public | function |
Sets the handlers for a given type. Overrides EntityTypeInterface:: |
|
EntityType:: |
public | function |
Sets the label callback. Overrides EntityTypeInterface:: |
|
EntityType:: |
public | function |
Sets a single link template. Overrides EntityTypeInterface:: |
|
EntityType:: |
public | function |
Sets the list class. Overrides EntityTypeInterface:: |
|
EntityType:: |
public | function |
Sets the storage class. Overrides EntityTypeInterface:: |
|
EntityType:: |
public | function |
Sets a callable to use to provide the entity URI. Overrides EntityTypeInterface:: |
|
EntityType:: |
public | function |
Gets the view builder class. Overrides EntityTypeInterface:: |
|
EntityTypeInterface:: |
constant | The maximum length of bundle name, in characters. | ||
EntityTypeInterface:: |
constant | The maximum length of ID, in characters. | ||
StringTranslationTrait:: |
protected | property | The string translation service. | |
StringTranslationTrait:: |
protected | function | Formats a string containing a count of items. | |
StringTranslationTrait:: |
protected | function | Returns the number of plurals supported by a given language. | |
StringTranslationTrait:: |
protected | function | Gets the string translation service. | |
StringTranslationTrait:: |
public | function | Sets the string translation service to use. | 2 |
StringTranslationTrait:: |
protected | function | Translates a string to the current language or to a given language. |