You are here

class ViewsPreViewEvent in Hook Event Dispatcher 8

Class ViewsPreRenderEvent.

Hierarchy

Expanded class hierarchy of ViewsPreViewEvent

3 files declare their use of ViewsPreViewEvent
ExampleViewsEventSubscribers.php in src/Example/ExampleViewsEventSubscribers.php
hook_event_dispatcher.module in ./hook_event_dispatcher.module
Hook event dispatcher module.
ViewEventTest.php in tests/src/Unit/Views/ViewEventTest.php

File

src/Event/Views/ViewsPreViewEvent.php, line 11

Namespace

Drupal\hook_event_dispatcher\Event\Views
View source
class ViewsPreViewEvent extends BaseViewsEvent {

  /**
   * Array of arguments passed into the view.
   *
   * @var array
   */
  private $arguments = [];

  /**
   * The machine name of the active display.
   *
   * @var string
   */
  private $displayId;

  /**
   * ViewsPreExecuteEevent constructor.
   *
   * @param \Drupal\views\ViewExecutable $view
   *   The view object about to be processed.
   * @param string $displayId
   *   The machine name of the active display.
   * @param array $arguments
   *   An array of arguments passed into the view.
   */
  public function __construct(ViewExecutable $view, $displayId, array &$arguments) {
    parent::__construct($view);
    $this->displayId = $displayId;
    $this->arguments =& $arguments;
  }

  /**
   * Get the machine name of the active display.
   *
   * @return string
   *   The machine name of the active display.
   */
  public function getDisplayId() {
    return $this->displayId;
  }

  /**
   * Get the array of view arguments.
   *
   * @return array
   *   The array of arguments passed into the view.
   */
  public function &getArguments() {
    return $this->arguments;
  }

  /**
   * {@inheritdoc}
   */
  public function getDispatcherType() {
    return HookEventDispatcherInterface::VIEWS_PRE_VIEW;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
BaseViewsEvent::$view private property The view.
BaseViewsEvent::getView public function Get the view.
ViewsPreViewEvent::$arguments private property Array of arguments passed into the view.
ViewsPreViewEvent::$displayId private property The machine name of the active display.
ViewsPreViewEvent::getArguments public function Get the array of view arguments.
ViewsPreViewEvent::getDispatcherType public function Get the dispatcher type. Overrides EventInterface::getDispatcherType
ViewsPreViewEvent::getDisplayId public function Get the machine name of the active display.
ViewsPreViewEvent::__construct public function ViewsPreExecuteEevent constructor. Overrides BaseViewsEvent::__construct