class Sequence in Drupal 10
Same name and namespace in other branches
- 8 core/lib/Drupal/Core/Config/Schema/Sequence.php \Drupal\Core\Config\Schema\Sequence
- 9 core/lib/Drupal/Core/Config/Schema/Sequence.php \Drupal\Core\Config\Schema\Sequence
Defines a configuration element of type Sequence.
This object may contain any number and type of nested elements that share a common definition in the 'sequence' property of the configuration schema.
Read https://www.drupal.org/node/1905070 for more details about configuration schema, types and type resolution.
Note that sequences implement the typed data ComplexDataInterface (via the parent ArrayElement) rather than the ListInterface. This is because sequences may have named keys, which is not supported by ListInterface. From the typed data API perspective sequences are handled as ordered mappings without metadata about existing properties.
Hierarchy
- class \Drupal\Core\TypedData\TypedData implements PluginInspectionInterface, TypedDataInterface uses DependencySerializationTrait, StringTranslationTrait, TypedDataTrait
- class \Drupal\Core\Config\Schema\Element
- class \Drupal\Core\Config\Schema\ArrayElement implements \Drupal\Core\Config\Schema\IteratorAggregate, TypedConfigInterface, ComplexDataInterface
- class \Drupal\Core\Config\Schema\Sequence
- class \Drupal\Core\Config\Schema\ArrayElement implements \Drupal\Core\Config\Schema\IteratorAggregate, TypedConfigInterface, ComplexDataInterface
- class \Drupal\Core\Config\Schema\Element
Expanded class hierarchy of Sequence
1 file declares its use of Sequence
- StorableConfigBase.php in core/
lib/ Drupal/ Core/ Config/ StorableConfigBase.php
2 string references to 'Sequence'
- core.data_types.schema.yml in core/
config/ schema/ core.data_types.schema.yml - core/config/schema/core.data_types.schema.yml
- core.data_types.schema.yml in core/
config/ schema/ core.data_types.schema.yml - core/config/schema/core.data_types.schema.yml
File
- core/
lib/ Drupal/ Core/ Config/ Schema/ Sequence.php, line 20
Namespace
Drupal\Core\Config\SchemaView source
class Sequence extends ArrayElement {
/**
* {@inheritdoc}
*/
protected function getElementDefinition($key) {
$value = $this->value[$key] ?? NULL;
// @todo: Remove BC layer for sequence with hyphen in front. https://www.drupal.org/node/2444979
$definition = [];
if (isset($this->definition['sequence'][0])) {
$definition = $this->definition['sequence'][0];
}
elseif ($this->definition['sequence']) {
$definition = $this->definition['sequence'];
}
return $this
->buildDataDefinition($definition, $value, $key);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
ArrayElement:: |
protected | property | Parsed elements. | |
ArrayElement:: |
protected | function | Creates a new data definition object from a type definition array and actual configuration data. | |
ArrayElement:: |
protected | function | Creates a contained typed configuration object. | |
ArrayElement:: |
public | function |
Gets a contained typed configuration element. Overrides TypedConfigInterface:: |
|
ArrayElement:: |
protected | function | Gets valid configuration data keys. | |
ArrayElement:: |
public | function |
Gets an array of contained elements. Overrides TypedConfigInterface:: |
|
ArrayElement:: |
public | function | ||
ArrayElement:: |
public | function |
Gets an array of property objects. Overrides ComplexDataInterface:: |
|
ArrayElement:: |
public | function |
Determines whether the data structure is empty. Overrides TypedConfigInterface:: |
|
ArrayElement:: |
public | function | Determines if this element allows NULL as a value. | |
ArrayElement:: |
public | function |
React to changes to a child property or item. Overrides TraversableTypedDataInterface:: |
|
ArrayElement:: |
protected | function | Builds an array of contained elements. | |
ArrayElement:: |
public | function |
Sets a property value. Overrides ComplexDataInterface:: |
|
ArrayElement:: |
public | function |
Returns an array of all property values. Overrides TypedConfigInterface:: |
|
DependencySerializationTrait:: |
protected | property | ||
DependencySerializationTrait:: |
protected | property | ||
DependencySerializationTrait:: |
public | function | 2 | |
DependencySerializationTrait:: |
public | function | 2 | |
Element:: |
protected | property | The configuration value. | |
Element:: |
public | function |
Gets the typed configuration manager. Overrides TypedDataTrait:: |
|
Element:: |
public | function |
Sets the typed config manager. Overrides TypedDataTrait:: |
|
Sequence:: |
protected | function |
Gets data definition object for contained element. Overrides ArrayElement:: |
|
StringTranslationTrait:: |
protected | property | The string translation service. | 3 |
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. | 1 |
StringTranslationTrait:: |
protected | function | Translates a string to the current language or to a given language. | |
TypedData:: |
protected | property | The data definition. | 1 |
TypedData:: |
protected | property | The property name. | |
TypedData:: |
protected | property | The parent typed data object. | |
TypedData:: |
public | function |
Applies the default value. Overrides TypedDataInterface:: |
2 |
TypedData:: |
public static | function |
Constructs a TypedData object given its definition and context. Overrides TypedDataInterface:: |
|
TypedData:: |
public | function |
Gets a list of validation constraints. Overrides TypedDataInterface:: |
9 |
TypedData:: |
public | function |
Gets the data definition. Overrides TypedDataInterface:: |
|
TypedData:: |
public | function |
Returns the name of a property or item. Overrides TypedDataInterface:: |
|
TypedData:: |
public | function |
Returns the parent data structure; i.e. either complex data or a list. Overrides TypedDataInterface:: |
|
TypedData:: |
public | function |
Gets the definition of the plugin implementation. Overrides PluginInspectionInterface:: |
|
TypedData:: |
public | function |
Gets the plugin_id of the plugin instance. Overrides PluginInspectionInterface:: |
|
TypedData:: |
public | function |
Returns the property path of the data. Overrides TypedDataInterface:: |
|
TypedData:: |
public | function |
Returns the root of the typed data tree. Overrides TypedDataInterface:: |
|
TypedData:: |
public | function |
Returns a string representation of the data. Overrides TypedDataInterface:: |
3 |
TypedData:: |
public | function |
Gets the data value. Overrides TypedDataInterface:: |
8 |
TypedData:: |
public | function |
Sets the context of a property or item via a context aware parent. Overrides TypedDataInterface:: |
|
TypedData:: |
public | function |
Sets the data value. Overrides TypedDataInterface:: |
7 |
TypedData:: |
public | function |
Validates the currently set data value. Overrides TypedDataInterface:: |
|
TypedData:: |
public | function | Constructs a TypedData object given its definition and context. | 3 |
TypedDataTrait:: |
protected | property | The typed data manager used for creating the data types. |