Security update for Core, with self-updated composer
[yaffs-website] / web / core / lib / Drupal / Core / Config / Schema / Sequence.php
1 <?php
2
3 namespace Drupal\Core\Config\Schema;
4
5 /**
6  * Defines a configuration element of type Sequence.
7  *
8  * This object may contain any number and type of nested elements that share
9  * a common definition in the 'sequence' property of the configuration schema.
10  *
11  * Read https://www.drupal.org/node/1905070 for more details about configuration
12  * schema, types and type resolution.
13  *
14  * Note that sequences implement the typed data ComplexDataInterface (via the
15  * parent ArrayElement) rather than the ListInterface. This is because sequences
16  * may have named keys, which is not supported by ListInterface. From the typed
17  * data API perspective sequences are handled as ordered mappings without
18  * metadata about existing properties.
19  */
20 class Sequence extends ArrayElement {
21
22   /**
23    * {@inheritdoc}
24    */
25   protected function getElementDefinition($key) {
26     $value = isset($this->value[$key]) ? $this->value[$key] : NULL;
27     // @todo: Remove BC layer for sequence with hyphen in front. https://www.drupal.org/node/2444979
28     $definition = [];
29     if (isset($this->definition['sequence'][0])) {
30       $definition = $this->definition['sequence'][0];
31     }
32     elseif ($this->definition['sequence']) {
33       $definition = $this->definition['sequence'];
34     }
35     return $this->buildDataDefinition($definition, $value, $key);
36   }
37
38 }