You are here

class EntityPostSaveEvent in YAML Content 8

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

Wraps a yaml content entity post-save event for event listeners.

Hierarchy

  • class \Drupal\yaml_content\Event\EventBase extends \Symfony\Component\EventDispatcher\Event

Expanded class hierarchy of EntityPostSaveEvent

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

File

src/Event/EntityPostSaveEvent.php, line 11

Namespace

Drupal\yaml_content\Event
View source
class EntityPostSaveEvent extends EventBase {

  /**
   * The imported and saved entity object.
   *
   * @var \Drupal\Core\Entity\EntityInterface
   */
  protected $entity;

  /**
   * The parsed content from the file used to create the entity.
   *
   * @var array
   */
  protected $contentData;

  /**
   * Constructs a yaml content entity post-save 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 loaded with content and saved.
   * @param array $content_data
   *   The parsed content loaded from the content file resulting in this entity.
   */
  public function __construct(ContentLoaderInterface $loader, EntityInterface $entity, array $content_data) {
    parent::__construct($loader);
    $this->entity = $entity;
    $this->contentData = $content_data;
  }

  /**
   * Gets the entity that was imported and saved.
   *
   * @return \Drupal\Core\Entity\EntityInterface
   *   The saved entity object.
   */
  public function getEntity() {
    return $this->entity;
  }

  /**
   * Gets the parsed content loaded from the content file to create the entity.
   *
   * @return array
   *   The parsed content from the file used to create the entity.
   */
  public function getContentData() {
    return $this->contentData;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
EntityPostSaveEvent::$contentData protected property The parsed content from the file used to create the entity.
EntityPostSaveEvent::$entity protected property The imported and saved entity object.
EntityPostSaveEvent::getContentData public function Gets the parsed content loaded from the content file to create the entity.
EntityPostSaveEvent::getEntity public function Gets the entity that was imported and saved.
EntityPostSaveEvent::__construct public function Constructs a yaml content entity post-save event object. Overrides EventBase::__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.