Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. ConfigSubscriber.php

function 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.'));
    }
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal