Drupal 8.0.0 beta 12. More info: https://www.drupal.org/node/2514176
This commit is contained in:
commit
9921556621
13277 changed files with 1459781 additions and 0 deletions
42
core/modules/config/src/ConfigSubscriber.php
Normal file
42
core/modules/config/src/ConfigSubscriber.php
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\config\ConfigSubscriber.
|
||||
*/
|
||||
|
||||
namespace Drupal\config;
|
||||
|
||||
use Drupal\Core\Config\ConfigEvents;
|
||||
use Drupal\Core\Config\ConfigImporterEvent;
|
||||
use Drupal\Core\Config\ConfigImporterException;
|
||||
use Drupal\Core\Config\ConfigImportValidateEventSubscriberBase;
|
||||
|
||||
|
||||
/**
|
||||
* Config subscriber.
|
||||
*/
|
||||
class ConfigSubscriber extends ConfigImportValidateEventSubscriberBase {
|
||||
|
||||
/**
|
||||
* Checks that the Configuration module is not being uninstalled.
|
||||
*
|
||||
* @param ConfigImporterEvent $event
|
||||
* The config import event.
|
||||
*/
|
||||
public function onConfigImporterValidate(ConfigImporterEvent $event) {
|
||||
$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}
|
||||
*/
|
||||
static function getSubscribedEvents() {
|
||||
$events[ConfigEvents::IMPORT_VALIDATE][] = array('onConfigImporterValidate', 20);
|
||||
return $events;
|
||||
}
|
||||
}
|
||||
Reference in a new issue