class ConfigImportSubscriber

Config import subscriber for config import events.

Hierarchy

Expanded class hierarchy of ConfigImportSubscriber

1 string reference to 'ConfigImportSubscriber'
core.services.yml in drupal/core/core.services.yml
drupal/core/core.services.yml

File

drupal/core/lib/Drupal/Core/EventSubscriber/ConfigImportSubscriber.php, line 18
Contains \Drupal\Core\EventSubscriber\ConfigImportSubscriber.

Namespace

Drupal\Core\EventSubscriber
View source
class ConfigImportSubscriber implements EventSubscriberInterface {

  /**
   * Validates the configuration to be imported.
   *
   * @param \Drupal\Core\Config\ConfigImporterEvent $event
   *   The Event to process.
   *
   * @throws \Drupal\Core\Config\ConfigNameException
   */
  public function onConfigImporterValidate(ConfigImporterEvent $event) {
    foreach (array(
      'delete',
      'create',
      'update',
    ) as $op) {
      foreach ($event
        ->getConfigImporter()
        ->getUnprocessed($op) as $name) {
        Config::validateName($name);
      }
    }
  }

  /**
   * Registers the methods in this class that should be listeners.
   *
   * @return array
   *   An array of event listener definitions.
   */
  static function getSubscribedEvents() {
    $events['config.importer.validate'][] = array(
      'onConfigImporterValidate',
      40,
    );
    $events['config.installer.validate'][] = array(
      'onConfigImporterValidate',
      40,
    );
    return $events;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
ConfigImportSubscriber::getSubscribedEvents static function Registers the methods in this class that should be listeners. Overrides EventSubscriberInterface::getSubscribedEvents
ConfigImportSubscriber::onConfigImporterValidate public function Validates the configuration to be imported.