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

This reverts commit 476e65a1e1.
merge-requests/5877/merge
Dave Long 2024-02-21 15:40:11 +00:00
parent 93cb498a88
commit 4f22397cc2
No known key found for this signature in database
GPG Key ID: ED52AE211E142771
3 changed files with 4 additions and 12 deletions

View File

@ -698,7 +698,7 @@ class ConfigImporter {
$missing_content = $sandbox['missing_content']['data'];
}
if (!empty($missing_content)) {
$event = new MissingContentEvent($missing_content, $this);
$event = new MissingContentEvent($missing_content);
// 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();

View File

@ -2,15 +2,14 @@
namespace Drupal\Core\Config\Importer;
use Drupal\Core\Config\ConfigImporter;
use Drupal\Core\Config\ConfigImporterEvent;
use Drupal\Component\EventDispatcher\Event;
/**
* Wraps a configuration event for event listeners.
*
* @see \Drupal\Core\Config\ConfigEvents::IMPORT_MISSING_CONTENT
*/
class MissingContentEvent extends ConfigImporterEvent {
class MissingContentEvent extends Event {
/**
* A list of missing content dependencies.
@ -24,11 +23,8 @@ class MissingContentEvent extends ConfigImporterEvent {
*
* @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, ConfigImporter $config_importer) {
parent::__construct($config_importer);
public function __construct(array $missing_content) {
$this->missingContent = $missing_content;
}

View File

@ -4,7 +4,6 @@ namespace Drupal\config_import_test;
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;
@ -73,9 +72,6 @@ class EventSubscriber implements EventSubscriberInterface {
* 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);