You are here

public function EventSubscriber::onConfigImporterValidate in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/config/tests/config_import_test/src/EventSubscriber.php \Drupal\config_import_test\EventSubscriber::onConfigImporterValidate()

Validates the configuration to be imported.

Parameters

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

Throws

\Drupal\Core\Config\ConfigNameException

File

core/modules/config/tests/config_import_test/src/EventSubscriber.php, line 42

Class

EventSubscriber
Config import subscriber for config import events.

Namespace

Drupal\config_import_test

Code

public function onConfigImporterValidate(ConfigImporterEvent $event) {
  if ($this->state
    ->get('config_import_test.config_import_validate_fail', FALSE)) {

    // Log more than one error to test multiple validation errors.
    $event
      ->getConfigImporter()
      ->logError('Config import validate error 1.');
    $event
      ->getConfigImporter()
      ->logError('Config import validate error 2.');
  }
}