FinalMissingContentSubscriber.php

Same filename in other branches
  1. 8.9.x core/lib/Drupal/Core/Config/Importer/FinalMissingContentSubscriber.php
  2. 10 core/lib/Drupal/Core/Config/Importer/FinalMissingContentSubscriber.php
  3. 11.x core/lib/Drupal/Core/Config/Importer/FinalMissingContentSubscriber.php

Namespace

Drupal\Core\Config\Importer

File

core/lib/Drupal/Core/Config/Importer/FinalMissingContentSubscriber.php

View source
<?php

namespace Drupal\Core\Config\Importer;

use Drupal\Core\Config\ConfigEvents;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;

/**
 * Final event subscriber to the missing content event.
 *
 * Ensure that all missing content dependencies are removed from the event so
 * the importer can complete.
 *
 * @see \Drupal\Core\Config\ConfigImporter::processMissingContent()
 */
class FinalMissingContentSubscriber implements EventSubscriberInterface {
    
    /**
     * Handles the missing content event.
     *
     * @param \Drupal\Core\Config\Importer\MissingContentEvent $event
     *   The missing content event.
     */
    public function onMissingContent(MissingContentEvent $event) {
        foreach (array_keys($event->getMissingContent()) as $uuid) {
            $event->resolveMissingContent($uuid);
        }
    }
    
    /**
     * {@inheritdoc}
     */
    public static function getSubscribedEvents() {
        // This should always be the final event as it will mark all content
        // dependencies as resolved.
        $events[ConfigEvents::IMPORT_MISSING_CONTENT][] = [
            'onMissingContent',
            -1024,
        ];
        return $events;
    }

}

Classes

Title Deprecated Summary
FinalMissingContentSubscriber Final event subscriber to the missing content event.

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