Patched to Drupal 8.4.8 level. See https://www.drupal.org/sa-core-2018-004 and patch...
[yaffs-website] / web / core / lib / Drupal / Core / Config / Importer / MissingContentEvent.php
1 <?php
2
3 namespace Drupal\Core\Config\Importer;
4
5 use Symfony\Component\EventDispatcher\Event;
6
7 /**
8  * Wraps a configuration event for event listeners.
9  *
10  * @see \Drupal\Core\Config\Config\ConfigEvents::IMPORT_MISSING_CONTENT
11  */
12 class MissingContentEvent extends Event {
13
14   /**
15    * A list of missing content dependencies.
16    *
17    * @var array
18    */
19   protected $missingContent;
20
21   /**
22    * Constructs a configuration import missing content event object.
23    *
24    * @param array $missing_content
25    *   Missing content information.
26    */
27   public function __construct(array $missing_content) {
28     $this->missingContent = $missing_content;
29   }
30
31   /**
32    * Gets missing content information.
33    *
34    * @return array
35    *   A list of missing content dependencies. The array is keyed by UUID. Each
36    *   value is an array with the following keys: 'entity_type', 'bundle' and
37    *   'uuid'.
38    */
39   public function getMissingContent() {
40     return $this->missingContent;
41   }
42
43   /**
44    * Resolves the missing content by removing it from the list.
45    *
46    * @param string $uuid
47    *   The UUID of the content entity to mark resolved.
48    *
49    * @return $this
50    *   The MissingContentEvent object.
51    */
52   public function resolveMissingContent($uuid) {
53     if (isset($this->missingContent[$uuid])) {
54       unset($this->missingContent[$uuid]);
55     }
56     return $this;
57   }
58
59 }