You are here

class EntityImportEvent in YAML Content 8

Same name and namespace in other branches
  1. 8.2 src/Event/EntityImportEvent.php \Drupal\yaml_content\Event\EntityImportEvent

Wraps a yaml content field import event for event listeners.

Hierarchy

Expanded class hierarchy of EntityImportEvent

1 file declares its use of EntityImportEvent
ContentLoader.php in src/ContentLoader/ContentLoader.php

File

src/Event/EntityImportEvent.php, line 11

Namespace

Drupal\yaml_content\Event
View source
class EntityImportEvent extends DataImportEvent {

  /**
   * The entity type object for the entity being created.
   *
   * @var \Drupal\Core\Entity\EntityTypeInterface
   */
  protected $entityType;

  /**
   * Constructs a yaml content entity import event object.
   *
   * @param \Drupal\yaml_content\ContentLoader\ContentLoaderInterface $loader
   *   The active Content Loader that triggered the event.
   * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type
   *   The field definition for the field being populated.
   * @param array $content_data
   *   The parsed content loaded from the content file to be loaded into
   *   the entity field.
   */
  public function __construct(ContentLoaderInterface $loader, EntityTypeInterface $entity_type, array $content_data) {
    parent::__construct($loader, $content_data);
    $this->entityType = $entity_type;
  }

  /**
   * Gets the field definition object for the field being populated.
   *
   * @return \Drupal\Core\Entity\EntityTypeInterface
   *   The entity type object for the entity being created.
   */
  public function getEntityType() {
    return $this->entityType;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
DataImportEvent::$contentData protected property The parsed content from the file used to create the entity.
DataImportEvent::getContentData public function Gets the parsed content to populate into the field.
EntityImportEvent::$entityType protected property The entity type object for the entity being created.
EntityImportEvent::getEntityType public function Gets the field definition object for the field being populated.
EntityImportEvent::__construct public function Constructs a yaml content entity import event object. Overrides DataImportEvent::__construct
EventBase::$contentLoader protected property The ContentLoader being actively executed and triggering the event.
EventBase::getContentLoader public function Gets the ContentLoader object that triggered the event.