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.
*
* @return \Drupal\Core\TypedData\DataDefinitionInterface
*/
- protected abstract function getElementDefinition($key);
+ abstract protected function getElementDefinition($key);
/**
* {@inheritdoc}
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;
+ }
+
}