class ConfigSubscriber

Same name in this branch
  1. 9 core/modules/language/src/EventSubscriber/ConfigSubscriber.php \Drupal\language\EventSubscriber\ConfigSubscriber
Same name in other branches
  1. 8.9.x core/modules/language/src/EventSubscriber/ConfigSubscriber.php \Drupal\language\EventSubscriber\ConfigSubscriber
  2. 8.9.x core/modules/config/src/ConfigSubscriber.php \Drupal\config\ConfigSubscriber
  3. 10 core/modules/language/src/EventSubscriber/ConfigSubscriber.php \Drupal\language\EventSubscriber\ConfigSubscriber
  4. 10 core/modules/config/src/ConfigSubscriber.php \Drupal\config\ConfigSubscriber
  5. 11.x core/modules/language/src/EventSubscriber/ConfigSubscriber.php \Drupal\language\EventSubscriber\ConfigSubscriber
  6. 11.x core/modules/config/src/ConfigSubscriber.php \Drupal\config\ConfigSubscriber

Config subscriber.

Hierarchy

Expanded class hierarchy of ConfigSubscriber

1 string reference to 'ConfigSubscriber'
config.services.yml in core/modules/config/config.services.yml
core/modules/config/config.services.yml
1 service uses ConfigSubscriber
config.config_subscriber in core/modules/config/config.services.yml
Drupal\config\ConfigSubscriber

File

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

Namespace

Drupal\config
View source
class ConfigSubscriber extends ConfigImportValidateEventSubscriberBase {
    
    /**
     * Checks that the Configuration module is not being uninstalled.
     *
     * @param \Drupal\Core\Config\ConfigImporterEvent $event
     *   The config import event.
     */
    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.'));
        }
    }
    
    /**
     * {@inheritdoc}
     */
    public static function getSubscribedEvents() {
        $events[ConfigEvents::IMPORT_VALIDATE][] = [
            'onConfigImporterValidate',
            20,
        ];
        return $events;
    }

}

Members

Title Sort descending Modifiers Object type Summary Overriden Title Overrides
ConfigSubscriber::getSubscribedEvents public static function Overrides ConfigImportValidateEventSubscriberBase::getSubscribedEvents
ConfigSubscriber::onConfigImporterValidate public function Checks that the Configuration module is not being uninstalled. Overrides ConfigImportValidateEventSubscriberBase::onConfigImporterValidate
StringTranslationTrait::$stringTranslation protected property The string translation service. 3
StringTranslationTrait::formatPlural protected function Formats a string containing a count of items.
StringTranslationTrait::getNumberOfPlurals protected function Returns the number of plurals supported by a given language.
StringTranslationTrait::getStringTranslation protected function Gets the string translation service.
StringTranslationTrait::setStringTranslation public function Sets the string translation service to use. 2
StringTranslationTrait::t protected function Translates a string to the current language or to a given language.

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