Mercurial > hg > isophonics-drupal-site
comparison core/modules/config/src/ConfigSubscriber.php @ 0:4c8ae668cc8c
Initial import (non-working)
author | Chris Cannam |
---|---|
date | Wed, 29 Nov 2017 16:09:58 +0000 |
parents | |
children | 7a779792577d |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:4c8ae668cc8c |
---|---|
1 <?php | |
2 | |
3 namespace Drupal\config; | |
4 | |
5 use Drupal\Core\Config\ConfigEvents; | |
6 use Drupal\Core\Config\ConfigImporterEvent; | |
7 use Drupal\Core\Config\ConfigImportValidateEventSubscriberBase; | |
8 | |
9 /** | |
10 * Config subscriber. | |
11 */ | |
12 class ConfigSubscriber extends ConfigImportValidateEventSubscriberBase { | |
13 | |
14 /** | |
15 * Checks that the Configuration module is not being uninstalled. | |
16 * | |
17 * @param ConfigImporterEvent $event | |
18 * The config import event. | |
19 */ | |
20 public function onConfigImporterValidate(ConfigImporterEvent $event) { | |
21 $importer = $event->getConfigImporter(); | |
22 $core_extension = $importer->getStorageComparer()->getSourceStorage()->read('core.extension'); | |
23 if (!isset($core_extension['module']['config'])) { | |
24 $importer->logError($this->t('Can not uninstall the Configuration module as part of a configuration synchronization through the user interface.')); | |
25 } | |
26 } | |
27 | |
28 /** | |
29 * {@inheritdoc} | |
30 */ | |
31 public static function getSubscribedEvents() { | |
32 $events[ConfigEvents::IMPORT_VALIDATE][] = ['onConfigImporterValidate', 20]; | |
33 return $events; | |
34 } | |
35 | |
36 } |