class ConfigSubscriber
Same name in this branch
- 11.x core/modules/language/src/EventSubscriber/ConfigSubscriber.php \Drupal\language\EventSubscriber\ConfigSubscriber
Same name in other branches
- 9 core/modules/language/src/EventSubscriber/ConfigSubscriber.php \Drupal\language\EventSubscriber\ConfigSubscriber
- 9 core/modules/config/src/ConfigSubscriber.php \Drupal\config\ConfigSubscriber
- 8.9.x core/modules/language/src/EventSubscriber/ConfigSubscriber.php \Drupal\language\EventSubscriber\ConfigSubscriber
- 8.9.x core/modules/config/src/ConfigSubscriber.php \Drupal\config\ConfigSubscriber
- 10 core/modules/language/src/EventSubscriber/ConfigSubscriber.php \Drupal\language\EventSubscriber\ConfigSubscriber
- 10 core/modules/config/src/ConfigSubscriber.php \Drupal\config\ConfigSubscriber
Config subscriber.
Hierarchy
- class \Drupal\Core\Config\ConfigImportValidateEventSubscriberBase implements \Symfony\Component\EventDispatcher\EventSubscriberInterface uses \Drupal\Core\StringTranslation\StringTranslationTrait
- class \Drupal\config\ConfigSubscriber extends \Drupal\Core\Config\ConfigImportValidateEventSubscriberBase
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\configView 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() : array {
$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.