Skip to content
Snippets Groups Projects
Verified Commit 476e65a1 authored by Dave Long's avatar Dave Long
Browse files

Issue #3414993 by alexpott: Add ConfigImporter to \Drupal\Core\Config\Importer\MissingContentEvent

(cherry picked from commit eafa8564)
parent 26e733a1
No related branches found
No related tags found
9 merge requests!8376Drupal views: adding more granularity to the ‘use ajax’ functionality,!8300Issue #3443586 View area displays even when parent view has no results.,!7567Issue #3153723 by quietone, Hardik_Patel_12: Change the scaffolding...,!7565Issue #3153723 by quietone, Hardik_Patel_12: Change the scaffolding...,!7509Change label "Block description" to "Block type",!7344Issue #3292350 by O'Briat, KlemenDEV, hswong3i, smustgrave, quietone: Update...,!6922Issue #3412959 by quietone, smustgrave, longwave: Fix 12 'un' words,!6848Issue #3417553 by longwave: Remove withConsecutive() in CacheCollectorTest,!6720Revert "Issue #3358581 by pfrenssen, _tarik_, a.dmitriiev, smustgrave:...
Pipeline #97946 passed
Pipeline: drupal

#97964

    Pipeline: drupal

    #97959

      Pipeline: drupal

      #97955

        +1
        ......@@ -698,7 +698,7 @@ protected function processMissingContent(&$context) {
        $missing_content = $sandbox['missing_content']['data'];
        }
        if (!empty($missing_content)) {
        $event = new MissingContentEvent($missing_content);
        $event = new MissingContentEvent($missing_content, $this);
        // Fire an event to allow listeners to create the missing content.
        $this->eventDispatcher->dispatch($event, ConfigEvents::IMPORT_MISSING_CONTENT);
        $sandbox['missing_content']['data'] = $event->getMissingContent();
        ......
        ......@@ -2,14 +2,15 @@
        namespace Drupal\Core\Config\Importer;
        use Drupal\Component\EventDispatcher\Event;
        use Drupal\Core\Config\ConfigImporter;
        use Drupal\Core\Config\ConfigImporterEvent;
        /**
        * Wraps a configuration event for event listeners.
        *
        * @see \Drupal\Core\Config\ConfigEvents::IMPORT_MISSING_CONTENT
        */
        class MissingContentEvent extends Event {
        class MissingContentEvent extends ConfigImporterEvent {
        /**
        * A list of missing content dependencies.
        ......@@ -23,8 +24,11 @@ class MissingContentEvent extends Event {
        *
        * @param array $missing_content
        * Missing content information.
        * @param \Drupal\Core\Config\ConfigImporter $config_importer
        * The config importer that triggered this event.
        */
        public function __construct(array $missing_content) {
        public function __construct(array $missing_content, ConfigImporter $config_importer) {
        parent::__construct($config_importer);
        $this->missingContent = $missing_content;
        }
        ......
        ......@@ -4,6 +4,7 @@
        use Drupal\Core\Config\ConfigCrudEvent;
        use Drupal\Core\Config\ConfigEvents;
        use Drupal\Core\Config\ConfigImporter;
        use Drupal\Core\Config\ConfigImporterEvent;
        use Drupal\Core\Config\Importer\MissingContentEvent;
        use Drupal\Core\State\StateInterface;
        ......@@ -72,6 +73,9 @@ public function onConfigImporterMissingContentOne(MissingContentEvent $event) {
        * The missing content event.
        */
        public function onConfigImporterMissingContentTwo(MissingContentEvent $event) {
        if (!$event->getConfigImporter() instanceof ConfigImporter) {
        throw new \LogicException('\Drupal\Core\Config\Importer\MissingContentEvent is missing the ConfigImporter');
        }
        if ($this->state->get('config_import_test.config_import_missing_content', FALSE) && $this->state->get('config_import_test.config_import_missing_content_two', FALSE) === FALSE) {
        $missing = $event->getMissingContent();
        $uuid = key($missing);
        ......
        0% Loading or .
        You are about to add 0 people to the discussion. Proceed with caution.
        Finish editing this message first!
        Please register or to comment