You are here

class FieldImportEvent in YAML Content 8

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

Wraps a yaml content field import event for event listeners.

Hierarchy

Expanded class hierarchy of FieldImportEvent

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

File

src/Event/FieldImportEvent.php, line 12

Namespace

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

  /**
   * The entity being populated with field data.
   *
   * @var \Drupal\Core\Entity\EntityInterface
   */
  protected $entity;

  /**
   * The field object being populated.
   *
   * @var \Drupal\Core\Field\FieldItemListInterface
   */
  protected $field;

  /**
   * Constructs a yaml content field import event object.
   *
   * @param \Drupal\yaml_content\ContentLoader\ContentLoaderInterface $loader
   *   The active Content Loader that triggered the event.
   * @param \Drupal\Core\Entity\EntityInterface $entity
   *   The entity being populated with field data.
   * @param \Drupal\Core\Field\FieldItemListInterface $field
   *   The field object 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, EntityInterface $entity, FieldItemListInterface $field, array $content_data) {
    parent::__construct($loader, $content_data);
    $this->entity = $entity;
    $this->field = $field;
  }

  /**
   * Gets the entity being populated with field data.
   *
   * @return \Drupal\Core\Entity\EntityInterface
   *   The entity being populated with field data.
   */
  public function getEntity() {
    return $this->entity;
  }

  /**
   * Gets the field object being populated.
   *
   * @return \Drupal\Core\Field\FieldItemListInterface
   *   The field object being populated.
   */
  public function getField() {
    return $this->field;
  }

}

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.
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.
FieldImportEvent::$entity protected property The entity being populated with field data.
FieldImportEvent::$field protected property The field object being populated.
FieldImportEvent::getEntity public function Gets the entity being populated with field data.
FieldImportEvent::getField public function Gets the field object being populated.
FieldImportEvent::__construct public function Constructs a yaml content field import event object. Overrides DataImportEvent::__construct