annotate core/modules/config/src/ConfigSubscriber.php @ 12:7a779792577d

Update Drupal core to v8.4.5 (via Composer)
author Chris Cannam
date Fri, 23 Feb 2018 15:52:07 +0000
parents 4c8ae668cc8c
children c2387f117808
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@12 17 * @param \Drupal\Core\Config\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 }