function ConfigSubscriber::onConfigImporterValidate

Same name in other branches
  1. 8.9.x core/modules/config/src/ConfigSubscriber.php \Drupal\config\ConfigSubscriber::onConfigImporterValidate()
  2. 10 core/modules/config/src/ConfigSubscriber.php \Drupal\config\ConfigSubscriber::onConfigImporterValidate()
  3. 11.x core/modules/config/src/ConfigSubscriber.php \Drupal\config\ConfigSubscriber::onConfigImporterValidate()

Checks that the Configuration module is not being uninstalled.

Parameters

\Drupal\Core\Config\ConfigImporterEvent $event: The config import event.

Overrides ConfigImportValidateEventSubscriberBase::onConfigImporterValidate

File

core/modules/config/src/ConfigSubscriber.php, line 20

Class

ConfigSubscriber
Config subscriber.

Namespace

Drupal\config

Code

public function onConfigImporterValidate(ConfigImporterEvent $event) {
    // Make sure config syncs performed via the Config UI don't break, but
    // don't worry about syncs initiated via the command line.
    if (PHP_SAPI === 'cli') {
        return;
    }
    $importer = $event->getConfigImporter();
    $core_extension = $importer->getStorageComparer()
        ->getSourceStorage()
        ->read('core.extension');
    if (!isset($core_extension['module']['config'])) {
        $importer->logError($this->t('Can not uninstall the Configuration module as part of a configuration synchronization through the user interface.'));
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.