Mercurial > hg > isophonics-drupal-site
annotate 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 |
rev | line source |
---|---|
Chris@0 | 1 <?php |
Chris@0 | 2 |
Chris@0 | 3 namespace Drupal\config; |
Chris@0 | 4 |
Chris@0 | 5 use Drupal\Core\Config\ConfigEvents; |
Chris@0 | 6 use Drupal\Core\Config\ConfigImporterEvent; |
Chris@0 | 7 use Drupal\Core\Config\ConfigImportValidateEventSubscriberBase; |
Chris@0 | 8 |
Chris@0 | 9 /** |
Chris@0 | 10 * Config subscriber. |
Chris@0 | 11 */ |
Chris@0 | 12 class ConfigSubscriber extends ConfigImportValidateEventSubscriberBase { |
Chris@0 | 13 |
Chris@0 | 14 /** |
Chris@0 | 15 * Checks that the Configuration module is not being uninstalled. |
Chris@0 | 16 * |
Chris@0 | 17 * @param ConfigImporterEvent $event |
Chris@0 | 18 * The config import event. |
Chris@0 | 19 */ |
Chris@0 | 20 public function onConfigImporterValidate(ConfigImporterEvent $event) { |
Chris@0 | 21 $importer = $event->getConfigImporter(); |
Chris@0 | 22 $core_extension = $importer->getStorageComparer()->getSourceStorage()->read('core.extension'); |
Chris@0 | 23 if (!isset($core_extension['module']['config'])) { |
Chris@0 | 24 $importer->logError($this->t('Can not uninstall the Configuration module as part of a configuration synchronization through the user interface.')); |
Chris@0 | 25 } |
Chris@0 | 26 } |
Chris@0 | 27 |
Chris@0 | 28 /** |
Chris@0 | 29 * {@inheritdoc} |
Chris@0 | 30 */ |
Chris@0 | 31 public static function getSubscribedEvents() { |
Chris@0 | 32 $events[ConfigEvents::IMPORT_VALIDATE][] = ['onConfigImporterValidate', 20]; |
Chris@0 | 33 return $events; |
Chris@0 | 34 } |
Chris@0 | 35 |
Chris@0 | 36 } |