X-Git-Url: http://aleph1.co.uk/gitweb/?a=blobdiff_plain;f=web%2Fcore%2Flib%2FDrupal%2FCore%2FConfig%2FSchema%2FArrayElement.php;h=b16cee0aeaaa560d98b5621045931c86373baf04;hb=680c79a86e3ed402f263faeac92e89fb6d9edcc0;hp=c5076554475dd4a79933ac399207b31d34b7be42;hpb=a2bd1bf0c2c1f1a17d188f4dc0726a45494cefae;p=yaffs-website diff --git a/web/core/lib/Drupal/Core/Config/Schema/ArrayElement.php b/web/core/lib/Drupal/Core/Config/Schema/ArrayElement.php index c50765544..b16cee0ae 100644 --- a/web/core/lib/Drupal/Core/Config/Schema/ArrayElement.php +++ b/web/core/lib/Drupal/Core/Config/Schema/ArrayElement.php @@ -2,10 +2,12 @@ namespace Drupal\Core\Config\Schema; +use Drupal\Core\TypedData\ComplexDataInterface; + /** * Defines a generic configuration element that contains multiple properties. */ -abstract class ArrayElement extends Element implements \IteratorAggregate, TypedConfigInterface { +abstract class ArrayElement extends Element implements \IteratorAggregate, TypedConfigInterface, ComplexDataInterface { /** * Parsed elements. @@ -46,7 +48,7 @@ abstract class ArrayElement extends Element implements \IteratorAggregate, Typed * * @return \Drupal\Core\TypedData\DataDefinitionInterface */ - protected abstract function getElementDefinition($key); + abstract protected function getElementDefinition($key); /** * {@inheritdoc} @@ -161,4 +163,25 @@ abstract class ArrayElement extends Element implements \IteratorAggregate, Typed return isset($this->definition['nullable']) && $this->definition['nullable'] == TRUE; } + /** + * {@inheritdoc} + */ + public function set($property_name, $value, $notify = TRUE) { + $this->value[$property_name] = $value; + // Config schema elements do not make use of notifications. Thus, we skip + // notifying parents. + return $this; + } + + /** + * {@inheritdoc} + */ + public function getProperties($include_computed = FALSE) { + $properties = []; + foreach (array_keys($this->value) as $name) { + $properties[$name] = $this->get($name); + } + return $properties; + } + }