class ConfigSubscriber in Drupal 8
Same name in this branch
- 8 core/modules/config/src/ConfigSubscriber.php \Drupal\config\ConfigSubscriber
- 8 core/modules/language/src/EventSubscriber/ConfigSubscriber.php \Drupal\language\EventSubscriber\ConfigSubscriber
Same name and namespace in other branches
- 9 core/modules/config/src/ConfigSubscriber.php \Drupal\config\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 StringTranslationTrait
- class \Drupal\config\ConfigSubscriber
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() {
$events[ConfigEvents::IMPORT_VALIDATE][] = [
'onConfigImporterValidate',
20,
];
return $events;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
ConfigSubscriber:: |
public static | function |
Returns an array of event names this subscriber wants to listen to. Overrides ConfigImportValidateEventSubscriberBase:: |
|
ConfigSubscriber:: |
public | function |
Checks that the Configuration module is not being uninstalled. Overrides ConfigImportValidateEventSubscriberBase:: |
|
StringTranslationTrait:: |
protected | property | The string translation service. | 1 |
StringTranslationTrait:: |
protected | function | Formats a string containing a count of items. | |
StringTranslationTrait:: |
protected | function | Returns the number of plurals supported by a given language. | |
StringTranslationTrait:: |
protected | function | Gets the string translation service. | |
StringTranslationTrait:: |
public | function | Sets the string translation service to use. | 2 |
StringTranslationTrait:: |
protected | function | Translates a string to the current language or to a given language. |