public function ConfigImportSubscriber::onConfigImporterValidate

public ConfigImportSubscriber::onConfigImporterValidate(ConfigImporterEvent $event)

Validates the configuration to be imported.

Parameters

\Drupal\Core\Config\ConfigImporterEvent $event: The Event to process.

Throws

\Drupal\Core\Config\ConfigNameException

Overrides ConfigImportValidateEventSubscriberBase::onConfigImporterValidate

File

core/lib/Drupal/Core/EventSubscriber/ConfigImportSubscriber.php, line 57

Class

ConfigImportSubscriber
Config import subscriber for config import events.

Namespace

Drupal\Core\EventSubscriber

Code

public function onConfigImporterValidate(ConfigImporterEvent $event) {
  foreach (array('delete', 'create', 'update') as $op) {
    foreach ($event->getConfigImporter()->getUnprocessedConfiguration($op) as $name) {
      try {
        Config::validateName($name);
      }
      catch (ConfigNameException $e) {
        $message = $this->t('The config name @config_name is invalid.', array('@config_name' => $name));
        $event->getConfigImporter()->logError($message);
      }
    }
  }
  $config_importer = $event->getConfigImporter();
  if ($config_importer->getStorageComparer()->getSourceStorage()->exists('core.extension')) {
    $this->validateModules($config_importer);
    $this->validateThemes($config_importer);
    $this->validateDependencies($config_importer);
  }
  else {
    $config_importer->logError($this->t('The core.extension configuration does not exist.'));
  }
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!EventSubscriber!ConfigImportSubscriber.php/function/ConfigImportSubscriber::onConfigImporterValidate/8.1.x