class SystemConfigSubscriber

System Config subscriber.

Hierarchy

Expanded class hierarchy of SystemConfigSubscriber

File

drupal/core/modules/system/lib/Drupal/system/SystemConfigSubscriber.php, line 21
Contains \Drupal\system\SystemConfigSubscriber.

Namespace

Drupal\system
View source
class SystemConfigSubscriber implements EventSubscriberInterface {

  /**
   * Implements EventSubscriberInterface::getSubscribedEvents().
   */
  static function getSubscribedEvents() {
    $events['config.importer.validate'][] = array(
      'onConfigImporterValidate',
      20,
    );
    return $events;
  }
  public function onConfigImporterValidate(ConfigImporterEvent $event) {
    $importer = $event
      ->getConfigImporter();
    $importList = $importer
      ->getStorageComparer()
      ->getSourceStorage()
      ->listAll();
    if (empty($importerList)) {
      throw new ConfigImporterException("This import will delete all your active configuration, I'm bailing out now.");
    }
  }

}

Members