3 namespace Drupal\config;
5 use Drupal\Core\Config\ConfigEvents;
6 use Drupal\Core\Config\ConfigImporterEvent;
7 use Drupal\Core\Config\ConfigImportValidateEventSubscriberBase;
13 class ConfigSubscriber extends ConfigImportValidateEventSubscriberBase {
16 * Checks that the Configuration module is not being uninstalled.
18 * @param ConfigImporterEvent $event
19 * The config import event.
21 public function onConfigImporterValidate(ConfigImporterEvent $event) {
22 $importer = $event->getConfigImporter();
23 $core_extension = $importer->getStorageComparer()->getSourceStorage()->read('core.extension');
24 if (!isset($core_extension['module']['config'])) {
25 $importer->logError($this->t('Can not uninstall the Configuration module as part of a configuration synchronization through the user interface.'));
32 public static function getSubscribedEvents() {
33 $events[ConfigEvents::IMPORT_VALIDATE][] = ['onConfigImporterValidate', 20];