You are here

public function EventSubscriber::onConfigImporterMissingContentOne in Drupal 10

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

Handles the missing content event.

Parameters

\Drupal\Core\Config\Importer\MissingContentEvent $event: The missing content event.

File

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

Class

EventSubscriber
Config import subscriber for config import events.

Namespace

Drupal\config_import_test

Code

public function onConfigImporterMissingContentOne(MissingContentEvent $event) {
  if ($this->state
    ->get('config_import_test.config_import_missing_content', FALSE) && $this->state
    ->get('config_import_test.config_import_missing_content_one', FALSE) === FALSE) {
    $missing = $event
      ->getMissingContent();
    $uuid = key($missing);
    $this->state
      ->set('config_import_test.config_import_missing_content_one', key($missing));
    $event
      ->resolveMissingContent($uuid);

    // Stopping propagation ensures that onConfigImporterMissingContentTwo
    // will be fired on the next batch step.
    $event
      ->stopPropagation();
  }
}