class LanguageHierarchyConfigOverride in Language Hierarchy 8
Same name and namespace in other branches
- 2.x src/Config/LanguageHierarchyConfigOverride.php \Drupal\language_hierarchy\Config\LanguageHierarchyConfigOverride
Defines language configuration overrides.
Hierarchy
- class \Drupal\Core\Config\ConfigBase implements RefinableCacheableDependencyInterface uses RefinableCacheableDependencyTrait, DependencySerializationTrait
- class \Drupal\Core\Config\StorableConfigBase
- class \Drupal\language\Config\LanguageConfigOverride uses LanguageConfigCollectionNameTrait
- class \Drupal\language_hierarchy\Config\LanguageHierarchyConfigOverride
- class \Drupal\language\Config\LanguageConfigOverride uses LanguageConfigCollectionNameTrait
- class \Drupal\Core\Config\StorableConfigBase
Expanded class hierarchy of LanguageHierarchyConfigOverride
File
- src/
Config/ LanguageHierarchyConfigOverride.php, line 13
Namespace
Drupal\language_hierarchy\ConfigView source
class LanguageHierarchyConfigOverride extends LanguageConfigOverride {
/**
* The language code that this override is for.
*
* The config storage may be for a fallback language.
*
* @var string
*/
protected $langcode;
/**
* The storage used to save this configuration object.
*
* @var \Drupal\Core\Config\StorageInterface
*/
protected $target_storage;
/**
* Constructs a language override object that may be for a fallback language.
*
* @param string $name
* The name of the configuration object being overridden.
* @param string $langcode
* The name of the language the override is intended for (i.e. the more
* specific language, whereas the config override may actually have come
* from the source storage for a fallback language).
* @param \Drupal\Core\Config\StorageInterface $source_storage
* A storage controller object to use for reading the configuration
* override.
* @param \Drupal\Core\Config\StorageInterface $target_storage
* A storage controller object to use for writing the configuration
* override.
* @param \Drupal\Core\Config\TypedConfigManagerInterface $typed_config
* The typed configuration manager service.
* @param \Symfony\Component\EventDispatcher\EventDispatcherInterface $event_dispatcher
* The event dispatcher.
*/
public function __construct($name, $langcode, StorageInterface $source_storage, StorageInterface $target_storage, TypedConfigManagerInterface $typed_config, EventDispatcherInterface $event_dispatcher) {
parent::__construct($name, $source_storage, $typed_config, $event_dispatcher);
$this->target_storage = $target_storage;
$this->langcode = $langcode;
}
/**
* {@inheritdoc}
*/
public function save($has_trusted_data = FALSE) {
// Swap storage used by the save method.
$source_storage = $this->storage;
$this->storage = $this->target_storage;
parent::save($has_trusted_data);
// Restore source storage.
$this->storage = $source_storage;
return $this;
}
/**
* {@inheritdoc}
*/
public function delete() {
// Swap storage used by the delete method.
$source_storage = $this->storage;
$this->storage = $this->target_storage;
parent::delete();
// Restore source storage.
$this->storage = $source_storage;
return $this;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
CacheableDependencyTrait:: |
protected | property | Cache contexts. | |
CacheableDependencyTrait:: |
protected | property | Cache max-age. | |
CacheableDependencyTrait:: |
protected | property | Cache tags. | |
CacheableDependencyTrait:: |
protected | function | Sets cacheability; useful for value object constructors. | |
ConfigBase:: |
protected | property | The data of the configuration object. | |
ConfigBase:: |
protected | property | The name of the configuration object. | |
ConfigBase:: |
protected | function | Casts any objects that implement MarkupInterface to string. | |
ConfigBase:: |
public | function | Unsets a value in this configuration object. | 1 |
ConfigBase:: |
public | function | Gets data from this configuration object. | 1 |
ConfigBase:: |
public | function |
The cache contexts associated with this object. Overrides CacheableDependencyTrait:: |
|
ConfigBase:: |
public | function |
The maximum age for which this object may be cached. Overrides CacheableDependencyTrait:: |
|
ConfigBase:: |
public | function |
The cache tags associated with this object. Overrides CacheableDependencyTrait:: |
1 |
ConfigBase:: |
public | function | Returns the name of this configuration object. | |
ConfigBase:: |
constant | The maximum length of a configuration object name. | ||
ConfigBase:: |
public | function | Merges data into a configuration object. | |
ConfigBase:: |
public | function | Sets a value in this configuration object. | 1 |
ConfigBase:: |
public | function | Replaces the data of this configuration object. | 1 |
ConfigBase:: |
public | function | Sets the name of this configuration object. | |
ConfigBase:: |
protected | function | Validates all keys in a passed in config array structure. | |
ConfigBase:: |
public static | function | Validates the configuration object name. | |
DependencySerializationTrait:: |
protected | property | An array of entity type IDs keyed by the property name of their storages. | |
DependencySerializationTrait:: |
protected | property | An array of service IDs keyed by property name used for serialization. | |
DependencySerializationTrait:: |
public | function | 1 | |
DependencySerializationTrait:: |
public | function | 2 | |
LanguageConfigCollectionNameTrait:: |
protected | function | Creates a configuration collection name based on a language code. | |
LanguageConfigCollectionNameTrait:: |
protected | function | Converts a configuration collection name to a language code. | |
LanguageConfigOverride:: |
protected | property | The event dispatcher. | |
LanguageConfigOverride:: |
public | function | Returns the language code of this language override. | |
LanguageHierarchyConfigOverride:: |
protected | property | The language code that this override is for. | |
LanguageHierarchyConfigOverride:: |
protected | property | The storage used to save this configuration object. | |
LanguageHierarchyConfigOverride:: |
public | function |
Deletes the configuration object. Overrides LanguageConfigOverride:: |
|
LanguageHierarchyConfigOverride:: |
public | function |
Saves the configuration object. Overrides LanguageConfigOverride:: |
|
LanguageHierarchyConfigOverride:: |
public | function |
Constructs a language override object that may be for a fallback language. Overrides LanguageConfigOverride:: |
|
RefinableCacheableDependencyTrait:: |
public | function | 1 | |
RefinableCacheableDependencyTrait:: |
public | function | ||
RefinableCacheableDependencyTrait:: |
public | function | ||
RefinableCacheableDependencyTrait:: |
public | function | ||
StorableConfigBase:: |
protected | property | Whether the configuration object is new or has been saved to the storage. | |
StorableConfigBase:: |
protected | property | The data of the configuration object. | |
StorableConfigBase:: |
protected | property | The config schema wrapper object for this configuration object. | |
StorableConfigBase:: |
protected | property | The storage used to load and save this configuration object. | |
StorableConfigBase:: |
protected | property | The typed config manager. | |
StorableConfigBase:: |
protected | function | Casts the value to correct data type using the configuration schema. | |
StorableConfigBase:: |
protected | function | Gets the schema wrapper for the whole configuration object. | |
StorableConfigBase:: |
public | function | Retrieves the storage used to load and save this configuration object. | |
StorableConfigBase:: |
public | function | Initializes a configuration object with pre-loaded data. | 1 |
StorableConfigBase:: |
public | function | Returns whether this configuration object is new. | |
StorableConfigBase:: |
protected | function | Validate the values are allowed data types. |