diff --git a/core/lib/Drupal/Core/Config/Schema/ArrayElement.php b/core/lib/Drupal/Core/Config/Schema/ArrayElement.php index f7fbb3b..c8b1a06 100644 --- a/core/lib/Drupal/Core/Config/Schema/ArrayElement.php +++ b/core/lib/Drupal/Core/Config/Schema/ArrayElement.php @@ -79,7 +79,8 @@ public function set($key, $value) { $this->value[$key] = $value; // Parsed elements must be rebuilt with new values unset($this->elements); - + // Directly notify ourselves. + $this->onChange($key, $value); return $this; } @@ -108,6 +109,16 @@ public function toArray() { } /** + * {@inheritdoc} + */ + public function onChange($key) { + // Notify the parent of changes. + if (isset($this->parent)) { + $this->parent->onChange($this->name); + } + } + + /** * Implements ArrayAccess::offsetExists(). */ public function offsetExists($offset) { diff --git a/core/lib/Drupal/Core/Config/Schema/ListElementInterface.php b/core/lib/Drupal/Core/Config/Schema/ListElementInterface.php index 783596f..b6a384f 100644 --- a/core/lib/Drupal/Core/Config/Schema/ListElementInterface.php +++ b/core/lib/Drupal/Core/Config/Schema/ListElementInterface.php @@ -69,12 +69,18 @@ public function set($key, $value); /** * Returns an array of all property values. * - * Gets an array of plain property values including all not-computed - * properties. - * * @return array * An array of property values, keyed by property name. */ public function toArray(); + /** + * React to changes to a child element. + * + * Note that this is invoked after any changes have been applied. + * + * @param $key + * The key of the property which is changed. + */ + public function onChange($key); } diff --git a/core/lib/Drupal/Core/Config/Schema/Mapping.php b/core/lib/Drupal/Core/Config/Schema/Mapping.php index 501e7db..91623e2 100644 --- a/core/lib/Drupal/Core/Config/Schema/Mapping.php +++ b/core/lib/Drupal/Core/Config/Schema/Mapping.php @@ -47,7 +47,7 @@ protected function parse() { * {@inheritdoc} */ public function set($key, $value) { - parent::__set($key, $value); + parent::set($key, $value); // We may need to rebuild property definitions. unset($this->propertyDefinitions); diff --git a/core/modules/config/src/Tests/ConfigSchemaTest.php b/core/modules/config/src/Tests/ConfigSchemaTest.php index 7401247..fc4f9ae 100644 --- a/core/modules/config/src/Tests/ConfigSchemaTest.php +++ b/core/modules/config/src/Tests/ConfigSchemaTest.php @@ -280,8 +280,8 @@ function testSchemaData() { $this->assertTrue(isset($list['front']) && isset($list['403']) && isset($list['404']), 'Got a list with the right properties for site page data.'); $this->assertEqual($list['front']->getValue(), 'user', 'Got the right value for page.front data from the list.'); - // And test some ComplexDataInterface methods. - $properties = $list->getProperties(); + // And test some ListElementInterface methods. + $properties = $list->getElements(); $this->assertTrue(count($properties) == 3 && $properties['front'] == $list['front'], 'Got the right properties for site page.'); $values = $list->toArray(); $this->assertTrue(count($values) == 3 && $values['front'] == 'user', 'Got the right property values for site page.'); diff --git a/core/modules/locale/src/Tests/LocaleConfigTranslationTest.php b/core/modules/locale/src/Tests/LocaleConfigTranslationTest.php index 94ec34d..5befd1a 100644 --- a/core/modules/locale/src/Tests/LocaleConfigTranslationTest.php +++ b/core/modules/locale/src/Tests/LocaleConfigTranslationTest.php @@ -81,7 +81,7 @@ function testConfigTranslation() { // Get translation and check we've only got the site name. $translation = $wrapper->getTranslation($langcode); - $properties = $translation->getProperties(); + $properties = $translation->getElements(); $this->assertEqual(count($properties), 1, 'Got the right number of properties after translation'); // Check the translated site name is displayed. diff --git a/core/modules/locale/src/Tests/LocaleImportFunctionalTest.php b/core/modules/locale/src/Tests/LocaleImportFunctionalTest.php index be3c22a..4e02ffd 100644 --- a/core/modules/locale/src/Tests/LocaleImportFunctionalTest.php +++ b/core/modules/locale/src/Tests/LocaleImportFunctionalTest.php @@ -297,7 +297,7 @@ function testConfigPoFile() { foreach ($config_strings as $config_key => $config_string) { $wrapper = $locale_config->get($config_key); $translation = $wrapper->getTranslation($langcode); - $properties = $translation->getProperties(); + $properties = $translation->getElements(); $this->assertEqual(count($properties), 1, 'Got the right number of properties with strict translation'); $this->assertEqual($properties[$config_string[2]]->getValue(), $config_string[1]); }