class PreEntityImportEvent

Event dispatched before an entity is created during default content import.

This event is dispatched for each entity before it is created from the decoded data. Subscribers can modify the entity data (default and translations) but not the metadata.

Hierarchy

  • class \Drupal\Core\DefaultContent\PreEntityImportEvent extends \Symfony\Contracts\EventDispatcher\Event

Expanded class hierarchy of PreEntityImportEvent

1 file declares its use of PreEntityImportEvent
ImporterTest.php in core/tests/Drupal/KernelTests/Core/DefaultContent/ImporterTest.php

File

core/lib/Drupal/Core/DefaultContent/PreEntityImportEvent.php, line 16

Namespace

Drupal\Core\DefaultContent
View source
final class PreEntityImportEvent extends Event {
  
  /**
   * The entity metadata.
   *
   * @var array<string, mixed>
   */
  public readonly array $metadata;
  public function __construct(public array $data) {
    $this->metadata = $data['_meta'];
    unset($this->data['_meta']);
  }

}

Members

Title Sort descending Modifiers Object type Summary
PreEntityImportEvent::$metadata public property The entity metadata.
PreEntityImportEvent::__construct public function

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