You are here

class ContentParsedEvent in YAML Content 8

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

Wraps a yaml content content parsed event for event listeners.

Hierarchy

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

Expanded class hierarchy of ContentParsedEvent

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

File

src/Event/ContentParsedEvent.php, line 10

Namespace

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

  /**
   * The full file path for the file that was parsed.
   *
   * @var string
   */
  protected $contentFile;

  /**
   * The parsed content from the file prepared for import.
   *
   * @var array
   */
  protected $parsedContent;

  /**
   * Constructs a yaml content content parsed event object.
   *
   * @param \Drupal\yaml_content\ContentLoader\ContentLoaderInterface $loader
   *   The active Content Loader that triggered the event.
   * @param string $content_file
   *   The full file path for the content file that was parsed.
   * @param array $parsed_content
   *   The parsed content loaded from the content file.
   */
  public function __construct(ContentLoaderInterface $loader, $content_file, array $parsed_content) {
    parent::__construct($loader);
    $this->contentFile = $content_file;
    $this->parsedContent = $parsed_content;
  }

  /**
   * Gets the file path of the content file that was loaded.
   *
   * @return string
   *   The file path for the content file that was loaded.
   */
  public function getContentFile() {
    return $this->contentFile;
  }

  /**
   * Gets the parsed content loaded from the content file.
   *
   * @return array
   *   The parsed content structure interpreted from the content file.
   */
  public function getParsedContent() {
    return $this->parsedContent;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
ContentParsedEvent::$contentFile protected property The full file path for the file that was parsed.
ContentParsedEvent::$parsedContent protected property The parsed content from the file prepared for import.
ContentParsedEvent::getContentFile public function Gets the file path of the content file that was loaded.
ContentParsedEvent::getParsedContent public function Gets the parsed content loaded from the content file.
ContentParsedEvent::__construct public function Constructs a yaml content content parsed 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.