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 += [ '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} * * @throws \Drupal\Core\Config\Entity\Exception\ConfigEntityStorageClassException * Exception thrown when the provided class is not an instance of * \Drupal\Core\Config\Entity\ConfigEntityStorage. * * @see \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($id = NULL) { if (!empty($this->mergedConfigExport)) { return $this->mergedConfigExport; } if (!empty($this->config_export)) { // Always add default properties to be exported. $this->mergedConfigExport = [ 'uuid' => 'uuid', 'langcode' => 'langcode', 'status' => 'status', 'dependencies' => 'dependencies', 'third_party_settings' => 'third_party_settings', '_core' => '_core', ]; foreach ($this->config_export as $property => $name) { if (is_numeric($property)) { $this->mergedConfigExport[$name] = $name; } else { $this->mergedConfigExport[$property] = $name; } } } else { // @todo https://www.drupal.org/project/drupal/issues/2949021 Deprecate // fallback to schema. $config_name = $this->getConfigPrefix() . '.' . $id; $definition = \Drupal::service('config.typed')->getDefinition($config_name); if (!isset($definition['mapping'])) { return NULL; } $this->mergedConfigExport = array_combine(array_keys($definition['mapping']), array_keys($definition['mapping'])); } return $this->mergedConfigExport; } /** * {@inheritdoc} */ public function getLookupKeys() { return $this->lookup_keys; } }