You are here

class FieldImportEvent in YAML Content 8.2

Same name and namespace in other branches
  1. 8 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
ContentLoaderBase.php in src/ContentLoader/ContentLoaderBase.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 defnition for the field being populated.
   *
   * @var \Drupal\Core\Field\FieldDefinitionInterface
   */
  protected $fieldDefinition;

  /**
   * 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\FieldDefinitionInterface $field_definition
   *   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, EntityInterface $entity, FieldDefinitionInterface $field_definition, array $content_data) {
    parent::__construct($loader, $content_data);
    $this->entity = $entity;
    $this->fieldDefinition = $field_definition;
  }

  /**
   * 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 definition object for the field being populated.
   *
   * @return \Drupal\Core\Field\FieldDefinitionInterface
   *   The field definition for the field being populated.
   */
  public function getFieldDefinition() {
    return $this->fieldDefinition;
  }

}

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