3 namespace Drupal\config;
5 use Drupal\Core\Config\ConfigEvents;
6 use Drupal\Core\Config\ConfigImporterEvent;
7 use Drupal\Core\Config\ConfigImportValidateEventSubscriberBase;
12 class ConfigSubscriber extends ConfigImportValidateEventSubscriberBase {
15 * Checks that the Configuration module is not being uninstalled.
17 * @param \Drupal\Core\Config\ConfigImporterEvent $event
18 * The config import event.
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.'));
31 public static function getSubscribedEvents() {
32 $events[ConfigEvents::IMPORT_VALIDATE][] = ['onConfigImporterValidate', 20];