You are here

public function ConfigSubscriber::onConfigImporterValidate in Drupal 8

Same name and namespace in other branches
  1. 9 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.'));
  }
}