LanguageConfigOverride
class LanguageConfigOverride extends StorableConfigBase (View source)
Defines language configuration overrides.
Traits
Provides a common trait for working with language override collection names.
Provides dependency injection friendly methods for serialization.
Trait for \Drupal\Core\Cache\RefinableCacheableDependencyInterface.
Trait for \Drupal\Core\Cache\CacheableDependencyInterface.
Constants
| MAX_NAME_LENGTH |
The maximum length of a configuration object name. Many filesystems (including HFS, NTFS, and ext4) have a maximum file name length of 255 characters. To ensure that no configuration objects incompatible with this limitation are created, we enforce a maximum name length of 250 characters (leaving 5 characters for the file extension). |
Properties
| protected array | $_serviceIds | An array of service IDs keyed by property name used for serialization. |
from DependencySerializationTrait |
| protected array | $_entityStorages | An array of entity type IDs keyed by the property name of their storages. |
from DependencySerializationTrait |
| protected string[] | $cacheContexts | Cache contexts. |
from CacheableDependencyTrait |
| protected string[] | $cacheTags | Cache tags. |
from CacheableDependencyTrait |
| protected int | $cacheMaxAge | Cache max-age. |
from CacheableDependencyTrait |
| protected string | $name | The name of the configuration object. |
from ConfigBase |
| protected array | $data | The data of the configuration object. |
from ConfigBase |
| protected StorageInterface | $storage | The storage used to load and save this configuration object. |
from StorableConfigBase |
| protected Element | $schemaWrapper | The config schema wrapper object for this configuration object. |
from StorableConfigBase |
| protected TypedConfigManagerInterface | $typedConfigManager | The typed config manager. |
from StorableConfigBase |
| protected bool | $isNew | Whether the configuration object is new or has been saved to the storage. |
from StorableConfigBase |
| protected array | $originalData | The data of the configuration object. |
from StorableConfigBase |
| protected EventDispatcherInterface | $eventDispatcher | The event dispatcher. |
Methods
Sets cacheability; useful for value object constructors.
Validates all keys in a passed in config array structure.
Casts any objects that implement MarkupInterface to string.
Saves the configuration object.
Deletes the configuration object.
Initializes a configuration object with pre-loaded data.
Retrieves the storage used to load and save this configuration object.
Gets the schema wrapper for the whole configuration object.
Validate the values are allowed data types.
Casts the value to correct data type using the configuration schema.
Creates a configuration collection name based on a language code.
Converts a configuration collection name to a language code.
Constructs a language override object.
Returns the language code of this language override.
Details
__sleep()
{@inheritdoc}
__wakeup()
{@inheritdoc}
protected $this
setCacheability(CacheableDependencyInterface $cacheability)
Sets cacheability; useful for value object constructors.
getCacheTags()
{@inheritdoc}
getCacheContexts()
{@inheritdoc}
getCacheMaxAge()
{@inheritdoc}
addCacheableDependency($other_object)
{@inheritdoc}
addCacheContexts(array $cache_contexts)
{@inheritdoc}
addCacheTags(array $cache_tags)
{@inheritdoc}
mergeCacheMaxAge($max_age)
{@inheritdoc}
string
getName()
Returns the name of this configuration object.
$this
setName(string $name)
Sets the name of this configuration object.
static
validateName(string $name)
Validates the configuration object name.
mixed
get(string $key = '')
Gets data from this configuration object.
$this
setData(array $data)
Replaces the data of this configuration object.
$this
set(string $key, mixed $value)
Sets a value in this configuration object.
protected null
validateKeys(array $data)
Validates all keys in a passed in config array structure.
$this
clear(string $key)
Unsets a value in this configuration object.
$this
merge(array $data_to_merge)
Merges data into a configuration object.
protected mixed
castSafeStrings(mixed $data)
Casts any objects that implement MarkupInterface to string.
$this
save(bool $has_trusted_data = FALSE)
Saves the configuration object.
Must invalidate the cache tags associated with the configuration object.
$this
delete()
Deletes the configuration object.
Must invalidate the cache tags associated with the configuration object.
$this
initWithData(array $data)
Initializes a configuration object with pre-loaded data.
bool
isNew()
Returns whether this configuration object is new.
StorageInterface
getStorage()
Retrieves the storage used to load and save this configuration object.
protected Element
getSchemaWrapper()
Gets the schema wrapper for the whole configuration object.
The schema wrapper is dependent on the configuration name and the whole data structure, so if the name or the data changes in any way, the wrapper should be reset.
protected null
validateValue(string $key, mixed $value)
Validate the values are allowed data types.
protected mixed
castValue(string|null $key, mixed $value)
Casts the value to correct data type using the configuration schema.
protected string
createConfigCollectionName(string $langcode)
Creates a configuration collection name based on a language code.
protected string
getLangcodeFromCollectionName(string $collection)
Converts a configuration collection name to a language code.
__construct(string $name, StorageInterface $storage, TypedConfigManagerInterface $typed_config, EventDispatcherInterface $event_dispatcher)
Constructs a language override object.
string
getLangcode()
Returns the language code of this language override.