function EventSubscriber::onConfigImporterValidate

Same name in other branches
  1. 9 core/modules/config/tests/config_import_test/src/EventSubscriber.php \Drupal\config_import_test\EventSubscriber::onConfigImporterValidate()
  2. 8.9.x core/modules/config/tests/config_import_test/src/EventSubscriber.php \Drupal\config_import_test\EventSubscriber::onConfigImporterValidate()
  3. 10 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 44

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.');
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.