diff --git a/core/lib/Drupal/Core/Config/Config.php b/core/lib/Drupal/Core/Config/Config.php index 89220498a536c455efce0a3b38f1824be4f68dae..e0002007b9e251698f104689a6d08dde262d3414 100644 --- a/core/lib/Drupal/Core/Config/Config.php +++ b/core/lib/Drupal/Core/Config/Config.php @@ -75,7 +75,7 @@ class Config extends DependencySerialization { * * @var array */ - protected $originalData; + protected $originalData = array(); /** * The current runtime data. @@ -458,7 +458,7 @@ public function save() { $this->storage->write($this->name, $this->data); $this->isNew = FALSE; - $this->notify('save'); + $this->eventDispatcher->dispatch(ConfigEvents::SAVE, new ConfigCrudEvent($this)); $this->originalData = $this->data; return $this; } @@ -475,7 +475,7 @@ public function delete() { $this->storage->delete($this->name); $this->isNew = TRUE; $this->resetOverriddenData(); - $this->notify('delete'); + $this->eventDispatcher->dispatch(ConfigEvents::DELETE, new ConfigCrudEvent($this)); $this->originalData = $this->data; return $this; } @@ -490,16 +490,6 @@ public function getStorage() { return $this->storage; } - /** - * Dispatches a configuration event. - * - * @param string $config_event_name - * The configuration event name. - */ - protected function notify($config_event_name) { - $this->eventDispatcher->dispatch('config.' . $config_event_name, new ConfigEvent($this)); - } - /** * Merges data into a configuration object. * diff --git a/core/lib/Drupal/Core/Config/ConfigCrudEvent.php b/core/lib/Drupal/Core/Config/ConfigCrudEvent.php new file mode 100644 index 0000000000000000000000000000000000000000..f7d9b70a38a21ca5e880b65df27ad3afcb354554 --- /dev/null +++ b/core/lib/Drupal/Core/Config/ConfigCrudEvent.php @@ -0,0 +1,57 @@ +<?php + +/** + * @file + * Contains \Drupal\Core\Config\ConfigCrudEvent. + */ + +namespace Drupal\Core\Config; + +use Symfony\Component\EventDispatcher\Event; + +/** + * Wraps a configuration event for event listeners. + */ +class ConfigCrudEvent extends Event { + + /** + * Configuration object. + * + * @var \Drupal\Core\Config\Config + */ + protected $config; + + /** + * Constructs a configuration event object. + * + * @param \Drupal\Core\Config\Config + * Configuration object. + */ + public function __construct(Config $config) { + $this->config = $config; + } + + /** + * Gets configuration object. + * + * @return \Drupal\Core\Config\Config + * The configuration object that caused the event to fire. + */ + public function getConfig() { + return $this->config; + } + + /** + * Checks to see if the provided configuration key's value has changed. + * + * @param string $key + * The configuration key to check if it has changed. + * + * @return bool + */ + public function isChanged($key) { + return $this->config->get($key) !== $this->config->getOriginal($key); + } + +} + diff --git a/core/lib/Drupal/Core/Config/ConfigEvent.php b/core/lib/Drupal/Core/Config/ConfigEvent.php deleted file mode 100644 index 5b07098a9ae3ce8a802cebb04b9c19a964551647..0000000000000000000000000000000000000000 --- a/core/lib/Drupal/Core/Config/ConfigEvent.php +++ /dev/null @@ -1,33 +0,0 @@ -<?php - -namespace Drupal\Core\Config; - -use Symfony\Component\EventDispatcher\Event; - -class ConfigEvent extends Event { - - /** - * Configuration object. - * - * @var \Drupal\Core\Config\Config - */ - protected $config; - - /** - * Constructs a configuration event object. - * - * @param \Drupal\Core\Config\Config - * Configuration object. - */ - public function __construct(Config $config) { - $this->config = $config; - } - - /** - * Get configuration object. - */ - public function getConfig() { - return $this->config; - } -} - diff --git a/core/lib/Drupal/Core/Config/ConfigEvents.php b/core/lib/Drupal/Core/Config/ConfigEvents.php new file mode 100644 index 0000000000000000000000000000000000000000..dd4c17fb306004b19d928be0b7014e00bf3227f3 --- /dev/null +++ b/core/lib/Drupal/Core/Config/ConfigEvents.php @@ -0,0 +1,60 @@ +<?php + +/** + * @file + * Contains Drupal\Core\Config\Config\ConfigEvents. + */ + +namespace Drupal\Core\Config; + +/** + * Defines events for the configuration system. + */ +class ConfigEvents { + + /** + * Name of event fired when saving the configuration object. + * + * @see \Drupal\Core\Config\Config::save() + * @see \Drupal\Core\Config\ConfigFactory::onConfigSave() + */ + const SAVE = 'config.save'; + + /** + * Name of event fired when deleting the configuration object. + * + * @see \Drupal\Core\Config\Config::delete() + */ + const DELETE = 'config.delete'; + + /** + * Name of event fired when renaming a configuration object. + * + * @see \Drupal\Core\Config\ConfigFactory::rename(). + */ + const RENAME = 'config.rename'; + + /** + * Name of event fired when collecting overrides for configuration objects. + * + * @see \Drupal\Core\Config\ConfigFactory::loadModuleOverrides(). + */ + const MODULE_OVERRIDES = 'config.module.overrides'; + + /** + * Name of event fired when validating in the configuration import process. + * + * @see \Drupal\Core\Config\ConfigImporter::validate(). + * @see \Drupal\Core\EventSubscriber\ConfigImportSubscriber::onConfigImporterValidate(). + */ + const VALIDATE = 'config.importer.validate'; + + /** + * Name of event fired when when importing configuration to target storage. + * + * @see \Drupal\Core\Config\ConfigImporter::import(). + * @see \Drupal\Core\EventSubscriber\ConfigSnapshotSubscriber::onConfigImporterImport(). + */ + const IMPORT = 'config.importer.import'; + +} diff --git a/core/lib/Drupal/Core/Config/ConfigFactory.php b/core/lib/Drupal/Core/Config/ConfigFactory.php index 8b74a70e9d68ce8cd198d8313771f1ba2eb88a76..3d26c7809b14a67c9da19da3aa14d740688c5b33 100644 --- a/core/lib/Drupal/Core/Config/ConfigFactory.php +++ b/core/lib/Drupal/Core/Config/ConfigFactory.php @@ -223,7 +223,7 @@ public function loadMultiple(array $names) { */ protected function loadModuleOverrides(array $names) { $configOverridesEvent = new ConfigModuleOverridesEvent($names, $this->language); - $this->eventDispatcher->dispatch('config.module.overrides', $configOverridesEvent); + $this->eventDispatcher->dispatch(ConfigEvents::MODULE_OVERRIDES, $configOverridesEvent); return $configOverridesEvent->getOverrides(); } @@ -258,12 +258,10 @@ public function rename($old_name, $new_name) { unset($this->cache[$old_cache_key]); } - $new_cache_key = $this->getCacheKey($new_name); - $this->cache[$new_cache_key] = new Config($new_name, $this->storage, $this->eventDispatcher, $this->typedConfigManager, $this->language); - if ($data = $this->storage->read($new_name)) { - $this->cache[$new_cache_key]->initWithData($data); - } - return $this->cache[$new_cache_key]; + // Prime the cache and load the configuration with the correct overrides. + $config = $this->get($new_name); + $this->eventDispatcher->dispatch(ConfigEvents::RENAME, new ConfigRenameEvent($config, $old_name)); + return $config; } /** @@ -370,10 +368,10 @@ protected function canOverride($name) { /** * Removes stale static cache entries when configuration is saved. * - * @param ConfigEvent $event + * @param ConfigCrudEvent $event * The configuration event. */ - public function onConfigSave(ConfigEvent $event) { + public function onConfigSave(ConfigCrudEvent $event) { // Ensure that the static cache contains up to date configuration objects by // replacing the data on any entries for the configuration object apart // from the one that references the actual config object being saved. @@ -390,7 +388,7 @@ public function onConfigSave(ConfigEvent $event) { * {@inheritdoc} */ static function getSubscribedEvents() { - $events['config.save'][] = array('onConfigSave', 255); + $events[ConfigEvents::SAVE][] = array('onConfigSave', 255); return $events; } diff --git a/core/lib/Drupal/Core/Config/ConfigImporter.php b/core/lib/Drupal/Core/Config/ConfigImporter.php index 92476b5f15f36dce436b3f32047ef21f25e98df1..d1590348b309b95451d7596373ec3443874c70dc 100644 --- a/core/lib/Drupal/Core/Config/ConfigImporter.php +++ b/core/lib/Drupal/Core/Config/ConfigImporter.php @@ -20,11 +20,11 @@ * * The ConfigImporter has a identifier which is used to construct event names. * The events fired during an import are: - * - 'config.importer.validate': Events listening can throw a + * - ConfigEvents::VALIDATE: Events listening can throw a * \Drupal\Core\Config\ConfigImporterException to prevent an import from * occurring. * @see \Drupal\Core\EventSubscriber\ConfigImportSubscriber - * - 'config.importer.import': Events listening can react to a successful import. + * - ConfigEvents::IMPORT: Events listening can react to a successful import. * @see \Drupal\Core\EventSubscriber\ConfigSnapshotSubscriber * * @see \Drupal\Core\Config\ConfigImporterEvent diff --git a/core/lib/Drupal/Core/Config/ConfigRenameEvent.php b/core/lib/Drupal/Core/Config/ConfigRenameEvent.php new file mode 100644 index 0000000000000000000000000000000000000000..83a3874b3322f672ffa9e49ff45086994061c2b3 --- /dev/null +++ b/core/lib/Drupal/Core/Config/ConfigRenameEvent.php @@ -0,0 +1,45 @@ +<?php + +/** + * @file + * Contains \Drupal\Core\Config\ConfigRenameEvent. + */ + +namespace Drupal\Core\Config; + +/** + * Configuration event fired when renaming a configuration object. + */ +class ConfigRenameEvent extends ConfigCrudEvent { + + /** + * The old configuration object name. + * + * @var string + */ + protected $oldName; + + /** + * Constructs the config rename event. + * + * @param \Drupal\Core\Config\Config $config + * The configuration that has been renamed. + * @param string $old_name + * The old configuration object name. + */ + public function __construct(Config $config, $old_name) { + $this->config = $config; + $this->oldName = $old_name; + } + + /** + * Gets the old configuration object name. + * + * @return string + * The old configuration object name. + */ + public function getOldName() { + return $this->oldName; + } + +} diff --git a/core/lib/Drupal/Core/EventSubscriber/ConfigImportSubscriber.php b/core/lib/Drupal/Core/EventSubscriber/ConfigImportSubscriber.php index 6cd31294736372dae836cbdf6e2b001504b59040..16267f406e113bb47d08a7544bab947d5a641a42 100644 --- a/core/lib/Drupal/Core/EventSubscriber/ConfigImportSubscriber.php +++ b/core/lib/Drupal/Core/EventSubscriber/ConfigImportSubscriber.php @@ -8,6 +8,7 @@ namespace Drupal\Core\EventSubscriber; use Drupal\Core\Config\Config; +use Drupal\Core\Config\ConfigEvents; use Drupal\Core\Config\ConfigImporterEvent; use Symfony\Component\EventDispatcher\EventSubscriberInterface; @@ -40,7 +41,7 @@ public function onConfigImporterValidate(ConfigImporterEvent $event) { * An array of event listener definitions. */ static function getSubscribedEvents() { - $events['config.importer.validate'][] = array('onConfigImporterValidate', 40); + $events[ConfigEvents::VALIDATE][] = array('onConfigImporterValidate', 40); return $events; } diff --git a/core/lib/Drupal/Core/EventSubscriber/ConfigSnapshotSubscriber.php b/core/lib/Drupal/Core/EventSubscriber/ConfigSnapshotSubscriber.php index 656eb2d0591c6fa293b434c8351e8d1d239da4d3..a8d0e060e191cf86a14b9b2cf64133785fde1b70 100644 --- a/core/lib/Drupal/Core/EventSubscriber/ConfigSnapshotSubscriber.php +++ b/core/lib/Drupal/Core/EventSubscriber/ConfigSnapshotSubscriber.php @@ -7,7 +7,7 @@ namespace Drupal\Core\EventSubscriber; -use Drupal\Core\Config\Config; +use Drupal\Core\Config\ConfigEvents; use Drupal\Core\Config\ConfigManagerInterface; use Drupal\Core\Config\StorageInterface; use Drupal\Core\Config\ConfigImporterEvent; @@ -70,7 +70,7 @@ public function onConfigImporterImport(ConfigImporterEvent $event) { * An array of event listener definitions. */ static function getSubscribedEvents() { - $events['config.importer.import'][] = array('onConfigImporterImport', 40); + $events[ConfigEvents::IMPORT][] = array('onConfigImporterImport', 40); return $events; } diff --git a/core/modules/config/lib/Drupal/config/Tests/ConfigEventsTest.php b/core/modules/config/lib/Drupal/config/Tests/ConfigEventsTest.php new file mode 100644 index 0000000000000000000000000000000000000000..27e88452c973e3ac39896aa4ce6c2216045fdd52 --- /dev/null +++ b/core/modules/config/lib/Drupal/config/Tests/ConfigEventsTest.php @@ -0,0 +1,90 @@ +<?php + +/** + * @file + * Contains \Drupal\config\Tests\ConfigEventsTest. + */ + +namespace Drupal\config\Tests; + +use Drupal\Core\Config\Config; +use Drupal\Core\Config\ConfigEvents; +use Drupal\simpletest\DrupalUnitTestBase; + +/** + * Tests CRUD operations on configuration objects. + */ +class ConfigEventsTest extends DrupalUnitTestBase { + + /** + * Modules to enable. + * + * @var array + */ + public static $modules = array('config_events_test'); + + public static function getInfo() { + return array( + 'name' => 'Config events', + 'description' => 'Tests events fired on configuration objects.', + 'group' => 'Configuration', + ); + } + + /** + * Tests configuration events. + */ + function testConfigEvents() { + $name = 'config_events_test.test'; + + $config = new Config($name, \Drupal::service('config.storage'), \Drupal::service('event_dispatcher'), \Drupal::service('config.typed')); + $config->set('key', 'initial'); + \Drupal::state()->get('config_events_test.event', FALSE); + $this->assertIdentical(\Drupal::state()->get('config_events_test.event', array()), array(), 'No events fired by creating a new configuration object'); + $config->save(); + + $event = \Drupal::state()->get('config_events_test.event', array()); + $this->assertIdentical($event['event_name'], ConfigEvents::SAVE); + $this->assertIdentical($event['current_config_data'], array('key' => 'initial')); + $this->assertIdentical($event['raw_config_data'], array('key' => 'initial')); + $this->assertIdentical($event['original_config_data'], array()); + + $config->set('key', 'updated')->save(); + $event = \Drupal::state()->get('config_events_test.event', array()); + $this->assertIdentical($event['event_name'], ConfigEvents::SAVE); + $this->assertIdentical($event['current_config_data'], array('key' => 'updated')); + $this->assertIdentical($event['raw_config_data'], array('key' => 'updated')); + $this->assertIdentical($event['original_config_data'], array('key' => 'initial')); + + $config->delete(); + $event = \Drupal::state()->get('config_events_test.event', array()); + $this->assertIdentical($event['event_name'], ConfigEvents::DELETE); + $this->assertIdentical($event['current_config_data'], array()); + $this->assertIdentical($event['raw_config_data'], array()); + $this->assertIdentical($event['original_config_data'], array('key' => 'updated')); + } + + /** + * Tests configuration rename event that is fired from the ConfigFactory. + */ + function testConfigRenameEvent() { + $name = 'config_events_test.test'; + $new_name = 'config_events_test.test_rename'; + $GLOBALS['config'][$name] = array('key' => 'overridden'); + $GLOBALS['config'][$new_name] = array('key' => 'new overridden'); + + $config = \Drupal::config($name); + $config->set('key', 'initial')->save(); + $event = \Drupal::state()->get('config_events_test.event', array()); + $this->assertIdentical($event['event_name'], ConfigEvents::SAVE); + $this->assertIdentical($event['current_config_data'], array('key' => 'overridden')); + + \Drupal::configFactory()->rename($name, $new_name); + $event = \Drupal::state()->get('config_events_test.event', array()); + $this->assertIdentical($event['event_name'], ConfigEvents::RENAME); + $this->assertIdentical($event['current_config_data'], array('key' => 'new overridden')); + $this->assertIdentical($event['raw_config_data'], array('key' => 'initial')); + $this->assertIdentical($event['original_config_data'], array('key' => 'new overridden')); + } + +} diff --git a/core/modules/config/tests/config_events_test/config_events_test.info.yml b/core/modules/config/tests/config_events_test/config_events_test.info.yml new file mode 100644 index 0000000000000000000000000000000000000000..6cb7504a8898dc7310be2487a0f9e26ac3417cda --- /dev/null +++ b/core/modules/config/tests/config_events_test/config_events_test.info.yml @@ -0,0 +1,6 @@ +name: 'Configuration events test' +type: module +package: Testing +version: VERSION +core: 8.x +hidden: true diff --git a/core/modules/config/tests/config_events_test/config_events_test.module b/core/modules/config/tests/config_events_test/config_events_test.module new file mode 100644 index 0000000000000000000000000000000000000000..aa5247540fdcf11660f8187e77c3346a8667a9ea --- /dev/null +++ b/core/modules/config/tests/config_events_test/config_events_test.module @@ -0,0 +1,6 @@ +<?php + +/** + * @file + * Provides Config event listeners for testing purposes. + */ diff --git a/core/modules/config/tests/config_events_test/config_events_test.services.yml b/core/modules/config/tests/config_events_test/config_events_test.services.yml new file mode 100644 index 0000000000000000000000000000000000000000..12d6fb1e19414aefe048e70282b18f3609f1ce89 --- /dev/null +++ b/core/modules/config/tests/config_events_test/config_events_test.services.yml @@ -0,0 +1,6 @@ +services: + config_events_test.event_subscriber: + class: Drupal\config_events_test\EventSubscriber + arguments: ['@state'] + tags: + - { name: event_subscriber } diff --git a/core/modules/config/tests/config_events_test/lib/Drupal/config_events_test/EventSubscriber.php b/core/modules/config/tests/config_events_test/lib/Drupal/config_events_test/EventSubscriber.php new file mode 100644 index 0000000000000000000000000000000000000000..853332d5209e7f4c86b3a0ceffd76a2ffa1e5127 --- /dev/null +++ b/core/modules/config/tests/config_events_test/lib/Drupal/config_events_test/EventSubscriber.php @@ -0,0 +1,60 @@ +<?php + +/** + * @file + * Contains \Drupal\config_events_test\EventSubscriber. + */ + +namespace Drupal\config_events_test; + + +use Drupal\Core\Config\ConfigCrudEvent; +use Drupal\Core\Config\ConfigEvents; +use Drupal\Core\KeyValueStore\StateInterface; +use Symfony\Component\EventDispatcher\EventSubscriberInterface; + +class EventSubscriber implements EventSubscriberInterface { + + /** + * The state key value store. + * + * @var \Drupal\Core\KeyValueStore\StateInterface + */ + protected $state; + + /** + * Constructs the Event Subscriber object. + * + * @param \Drupal\Core\KeyValueStore\StateInterface $state + * The state key value store. + */ + public function __construct(StateInterface $state) { + $this->state = $state; + } + + /** + * Reacts to config event. + * + * @param \Drupal\Core\Config\ConfigCrudEvent $event + * The configuration event. + */ + public function configEventRecorder(ConfigCrudEvent $event) { + $config = $event->getConfig(); + $this->state->set('config_events_test.event', array( + 'event_name' => $event->getName(), + 'current_config_data' => $config->get(), + 'original_config_data' => $config->getOriginal(), + 'raw_config_data' => $config->getRawData() + )); + } + + /** + * {@inheritdoc} + */ + static function getSubscribedEvents() { + $events[ConfigEvents::SAVE][] = array('configEventRecorder'); + $events[ConfigEvents::DELETE][] = array('configEventRecorder'); + $events[ConfigEvents::RENAME][] = array('configEventRecorder'); + return $events; + } +} diff --git a/core/modules/config/tests/config_override/lib/Drupal/config_override/EventSubscriber/ConfigModuleLowPriorityOverrideSubscriber.php b/core/modules/config/tests/config_override/lib/Drupal/config_override/EventSubscriber/ConfigModuleLowPriorityOverrideSubscriber.php index 1e1b5ef44d19c60599600b77fbd60b6c66695888..fd7e26cf9338f8ac736ecf62300ab589d9db7003 100644 --- a/core/modules/config/tests/config_override/lib/Drupal/config_override/EventSubscriber/ConfigModuleLowPriorityOverrideSubscriber.php +++ b/core/modules/config/tests/config_override/lib/Drupal/config_override/EventSubscriber/ConfigModuleLowPriorityOverrideSubscriber.php @@ -7,6 +7,7 @@ namespace Drupal\config_override\EventSubscriber; +use Drupal\Core\Config\ConfigEvents; use Drupal\Core\Config\ConfigModuleOverridesEvent; use Symfony\Component\EventDispatcher\EventSubscriberInterface; @@ -36,7 +37,7 @@ public function onConfigModuleOverride(ConfigModuleOverridesEvent $event) { * An array of event listener definitions. */ static function getSubscribedEvents() { - $events['config.module.overrides'][] = array('onConfigModuleOverride', 35); + $events[ConfigEvents::MODULE_OVERRIDES][] = array('onConfigModuleOverride', 35); return $events; } } diff --git a/core/modules/config/tests/config_override/lib/Drupal/config_override/EventSubscriber/ConfigModuleOverrideSubscriber.php b/core/modules/config/tests/config_override/lib/Drupal/config_override/EventSubscriber/ConfigModuleOverrideSubscriber.php index 54f0f6465a701046608b67a9340ed84a2f08760c..e1681117de616221597a46b41dec8b354ec23a83 100644 --- a/core/modules/config/tests/config_override/lib/Drupal/config_override/EventSubscriber/ConfigModuleOverrideSubscriber.php +++ b/core/modules/config/tests/config_override/lib/Drupal/config_override/EventSubscriber/ConfigModuleOverrideSubscriber.php @@ -7,6 +7,7 @@ namespace Drupal\config_override\EventSubscriber; +use Drupal\Core\Config\ConfigEvents; use Drupal\Core\Config\ConfigModuleOverridesEvent; use Symfony\Component\EventDispatcher\EventSubscriberInterface; @@ -34,7 +35,7 @@ public function onConfigModuleOverride(ConfigModuleOverridesEvent $event) { * An array of event listener definitions. */ static function getSubscribedEvents() { - $events['config.module.overrides'][] = array('onConfigModuleOverride', 40); + $events[ConfigEvents::MODULE_OVERRIDES][] = array('onConfigModuleOverride', 40); return $events; } } diff --git a/core/modules/language/lib/Drupal/language/EventSubscriber/ConfigSubscriber.php b/core/modules/language/lib/Drupal/language/EventSubscriber/ConfigSubscriber.php index 819c2d341f596a6456770f55d52ca440b0911155..82b6f9d0d0784f0cc39c80e37cad6181a00a13c4 100644 --- a/core/modules/language/lib/Drupal/language/EventSubscriber/ConfigSubscriber.php +++ b/core/modules/language/lib/Drupal/language/EventSubscriber/ConfigSubscriber.php @@ -8,7 +8,8 @@ namespace Drupal\language\EventSubscriber; use Drupal\Component\PhpStorage\PhpStorageFactory; -use Drupal\Core\Config\ConfigEvent; +use Drupal\Core\Config\ConfigCrudEvent; +use Drupal\Core\Config\ConfigEvents; use Symfony\Component\EventDispatcher\EventSubscriberInterface; /** @@ -19,12 +20,12 @@ class ConfigSubscriber implements EventSubscriberInterface { /** * Causes the container to be rebuilt on the next request. * - * @param ConfigEvent $event + * @param ConfigCrudEvent $event * The configuration event. */ - public function onConfigSave(ConfigEvent $event) { + public function onConfigSave(ConfigCrudEvent $event) { $saved_config = $event->getConfig(); - if ($saved_config->getName() == 'system.site' && $saved_config->get('langcode') != $saved_config->getOriginal('langcode')) { + if ($saved_config->getName() == 'system.site' && $event->isChanged('langcode')) { // Trigger a container rebuild on the next request by deleting compiled // from PHP storage. PhpStorageFactory::get('service_container')->deleteAll(); @@ -35,7 +36,7 @@ public function onConfigSave(ConfigEvent $event) { * {@inheritdoc} */ static function getSubscribedEvents() { - $events['config.save'][] = array('onConfigSave', 0); + $events[ConfigEvents::SAVE][] = array('onConfigSave', 0); return $events; } diff --git a/core/modules/system/lib/Drupal/system/SystemConfigSubscriber.php b/core/modules/system/lib/Drupal/system/SystemConfigSubscriber.php index d6e1fc6ac8bfd86cdbefddbc37f94255241f2869..4abc7144c420b16a6db03f2a6c3aeb011e343fe1 100644 --- a/core/modules/system/lib/Drupal/system/SystemConfigSubscriber.php +++ b/core/modules/system/lib/Drupal/system/SystemConfigSubscriber.php @@ -7,6 +7,7 @@ namespace Drupal\system; +use Drupal\Core\Config\ConfigEvents; use Drupal\Core\Config\ConfigImporterEvent; use Drupal\Core\Config\ConfigImporterException; use Drupal\Core\Config\StorageDispatcher; @@ -21,7 +22,7 @@ class SystemConfigSubscriber implements EventSubscriberInterface { * {@inheritdoc} */ static function getSubscribedEvents() { - $events['config.importer.validate'][] = array('onConfigImporterValidate', 20); + $events[ConfigEvents::VALIDATE][] = array('onConfigImporterValidate', 20); return $events; }