class MissingContentEvent

Same name in other branches
  1. 9 core/lib/Drupal/Core/Config/Importer/MissingContentEvent.php \Drupal\Core\Config\Importer\MissingContentEvent
  2. 8.9.x core/lib/Drupal/Core/Config/Importer/MissingContentEvent.php \Drupal\Core\Config\Importer\MissingContentEvent
  3. 11.x core/lib/Drupal/Core/Config/Importer/MissingContentEvent.php \Drupal\Core\Config\Importer\MissingContentEvent

Wraps a configuration event for event listeners.

Hierarchy

  • class \Drupal\Component\EventDispatcher\Event extends \Symfony\Contracts\EventDispatcher\Event
    • class \Drupal\Core\Config\Importer\MissingContentEvent extends \Drupal\Component\EventDispatcher\Event

Expanded class hierarchy of MissingContentEvent

See also

\Drupal\Core\Config\ConfigEvents::IMPORT_MISSING_CONTENT

2 files declare their use of MissingContentEvent
ConfigImporter.php in core/lib/Drupal/Core/Config/ConfigImporter.php
EventSubscriber.php in core/modules/config/tests/config_import_test/src/EventSubscriber.php

File

core/lib/Drupal/Core/Config/Importer/MissingContentEvent.php, line 12

Namespace

Drupal\Core\Config\Importer
View source
class MissingContentEvent extends Event {
    
    /**
     * A list of missing content dependencies.
     *
     * @var array
     */
    protected $missingContent;
    
    /**
     * Constructs a configuration import missing content event object.
     *
     * @param array $missing_content
     *   Missing content information.
     */
    public function __construct(array $missing_content) {
        $this->missingContent = $missing_content;
    }
    
    /**
     * Gets missing content information.
     *
     * @return array
     *   A list of missing content dependencies. The array is keyed by UUID. Each
     *   value is an array with the following keys: 'entity_type', 'bundle' and
     *   'uuid'.
     */
    public function getMissingContent() {
        return $this->missingContent;
    }
    
    /**
     * Resolves the missing content by removing it from the list.
     *
     * @param string $uuid
     *   The UUID of the content entity to mark resolved.
     *
     * @return $this
     *   The MissingContentEvent object.
     */
    public function resolveMissingContent($uuid) {
        if (isset($this->missingContent[$uuid])) {
            unset($this->missingContent[$uuid]);
        }
        return $this;
    }

}

Members

Title Sort descending Modifiers Object type Summary
MissingContentEvent::$missingContent protected property A list of missing content dependencies.
MissingContentEvent::getMissingContent public function Gets missing content information.
MissingContentEvent::resolveMissingContent public function Resolves the missing content by removing it from the list.
MissingContentEvent::__construct public function Constructs a configuration import missing content event object.

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