class ModifyHtmlEvent in Tome 8
Allows modules to modify the HTML of a static page before save.
Hierarchy
- class \Drupal\tome_static\Event\ModifyHtmlEvent extends \Symfony\Component\EventDispatcher\Event
Expanded class hierarchy of ModifyHtmlEvent
4 files declare their use of ModifyHtmlEvent
- MediaOembedPathSubscriber.php in modules/tome_static/ src/ EventSubscriber/ MediaOembedPathSubscriber.php 
- ModifyHtmlEventTest.php in modules/tome_static/ tests/ src/ Kernel/ ModifyHtmlEventTest.php 
- PagerPathSubscriber.php in modules/tome_static/ src/ EventSubscriber/ PagerPathSubscriber.php 
- StaticGenerator.php in modules/tome_static/ src/ StaticGenerator.php 
File
- modules/tome_static/ src/ Event/ ModifyHtmlEvent.php, line 10 
Namespace
Drupal\tome_static\EventView source
class ModifyHtmlEvent extends Event {
  /**
   * The page's HTML.
   *
   * @var string
   */
  protected $html;
  /**
   * An array of paths to invoke.
   *
   * @var array
   */
  protected $invokePaths = [];
  /**
   * An array of paths to exclude.
   *
   * This is useful if you're replacing paths in the HTML.
   *
   * @var array
   */
  protected $excludePaths = [];
  /**
   * The current path.
   *
   * @var string
   */
  protected $path;
  /**
   * Constructs a ModifyHtmlEvent object.
   *
   * @param string $html
   *   The page's HTML.
   * @param string $path
   *   The current path.
   */
  public function __construct($html, $path) {
    $this->html = $html;
    $this->path = $path;
  }
  /**
   * Returns the current path.
   *
   * @return string
   *   The path.
   */
  public function getPath() {
    return $this->path;
  }
  /**
   * Adds a path to invoke.
   *
   * @param string $path
   *   The path.
   */
  public function addInvokePath($path) {
    $this->invokePaths[] = $path;
  }
  /**
   * Gets the invoke paths.
   *
   * @return array
   *   The invoke paths.
   */
  public function getInvokePaths() {
    return $this->invokePaths;
  }
  /**
   * Gets the exclude paths.
   *
   * @return array
   *   The exclude paths.
   */
  public function getExcludePaths() {
    return $this->excludePaths;
  }
  /**
   * Adds a path to exclude.
   *
   * @param string $path
   *   The path.
   */
  public function addExcludePath($path) {
    $this->excludePaths[] = $path;
  }
  /**
   * Gets the HTML for this page.
   *
   * @return string
   *   The HTML.
   */
  public function getHtml() {
    return $this->html;
  }
  /**
   * Sets the HTML for this page.
   *
   * @param string $html
   *   The HTML.
   */
  public function setHtml($html) {
    $this->html = $html;
  }
}Members
| Name   | Modifiers | Type | Description | Overrides | 
|---|---|---|---|---|
| ModifyHtmlEvent:: | protected | property | An array of paths to exclude. | |
| ModifyHtmlEvent:: | protected | property | The page's HTML. | |
| ModifyHtmlEvent:: | protected | property | An array of paths to invoke. | |
| ModifyHtmlEvent:: | protected | property | The current path. | |
| ModifyHtmlEvent:: | public | function | Adds a path to exclude. | |
| ModifyHtmlEvent:: | public | function | Adds a path to invoke. | |
| ModifyHtmlEvent:: | public | function | Gets the exclude paths. | |
| ModifyHtmlEvent:: | public | function | Gets the HTML for this page. | |
| ModifyHtmlEvent:: | public | function | Gets the invoke paths. | |
| ModifyHtmlEvent:: | public | function | Returns the current path. | |
| ModifyHtmlEvent:: | public | function | Sets the HTML for this page. | |
| ModifyHtmlEvent:: | public | function | Constructs a ModifyHtmlEvent object. | 
