You are here

class PathPlaceholderEvent in Tome 8

Allows modules that provide placeholder paths to load the real path.

Hierarchy

  • class \Drupal\tome_static\Event\PathPlaceholderEvent extends \Symfony\Component\EventDispatcher\Event

Expanded class hierarchy of PathPlaceholderEvent

4 files declare their use of PathPlaceholderEvent
EntityPathSubscriber.php in modules/tome_static/src/EventSubscriber/EntityPathSubscriber.php
PathPlaceholderEventTest.php in modules/tome_static/tests/src/Kernel/PathPlaceholderEventTest.php
RedirectPathSubscriber.php in modules/tome_static/src/EventSubscriber/RedirectPathSubscriber.php
StaticGenerator.php in modules/tome_static/src/StaticGenerator.php

File

modules/tome_static/src/Event/PathPlaceholderEvent.php, line 10

Namespace

Drupal\tome_static\Event
View source
class PathPlaceholderEvent extends Event {

  /**
   * The path.
   *
   * @var string
   */
  protected $path;

  /**
   * If a placeholdered path is invalid.
   *
   * @var bool
   */
  protected $isInvalid;

  /**
   * Constructs a PathPlaceholderEvent object.
   *
   * @param string $path
   *   A path.
   */
  public function __construct($path) {
    $this->path = $path;
    $this->isInvalid = FALSE;
  }

  /**
   * Gets the path.
   *
   * @return string
   *   The path.
   */
  public function getPath() {
    return $this->path;
  }

  /**
   * Sets the path.
   *
   * @param string $path
   *   The path.
   */
  public function setPath($path) {
    $this->path = $path;
  }

  /**
   * Marks the path as invalid.
   *
   * Useful if a placeholder is malformed.
   */
  public function setInvalid() {
    $this->isInvalid = TRUE;
  }

  /**
   * Checks if the path was marked as invalid.
   *
   * @return string
   *   Whether or not the path was marked as invalid.
   */
  public function isInvalid() {
    return $this->isInvalid;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
PathPlaceholderEvent::$isInvalid protected property If a placeholdered path is invalid.
PathPlaceholderEvent::$path protected property The path.
PathPlaceholderEvent::getPath public function Gets the path.
PathPlaceholderEvent::isInvalid public function Checks if the path was marked as invalid.
PathPlaceholderEvent::setInvalid public function Marks the path as invalid.
PathPlaceholderEvent::setPath public function Sets the path.
PathPlaceholderEvent::__construct public function Constructs a PathPlaceholderEvent object.