Updated Drupal to 8.6. This goes with the following updates because it's possible...
[yaffs-website] / web / core / lib / Drupal / Core / Config / Importer / FinalMissingContentSubscriber.php
1 <?php
2
3 namespace Drupal\Core\Config\Importer;
4
5 use Drupal\Core\Config\ConfigEvents;
6 use Symfony\Component\EventDispatcher\EventSubscriberInterface;
7
8 /**
9  * Final event subscriber to the missing content event.
10  *
11  * Ensure that all missing content dependencies are removed from the event so
12  * the importer can complete.
13  *
14  * @see \Drupal\Core\Config\ConfigImporter::processMissingContent()
15  */
16 class FinalMissingContentSubscriber implements EventSubscriberInterface {
17
18   /**
19    * Handles the missing content event.
20    *
21    * @param \Drupal\Core\Config\Importer\MissingContentEvent $event
22    *   The missing content event.
23    */
24   public function onMissingContent(MissingContentEvent $event) {
25     foreach (array_keys($event->getMissingContent()) as $uuid) {
26       $event->resolveMissingContent($uuid);
27     }
28   }
29
30   /**
31    * {@inheritdoc}
32    */
33   public static function getSubscribedEvents() {
34     // This should always be the final event as it will mark all content
35     // dependencies as resolved.
36     $events[ConfigEvents::IMPORT_MISSING_CONTENT][] = ['onMissingContent', -1024];
37     return $events;
38   }
39
40 }