You are here

final class ViewsQuerySubstitutionsEvent in Hook Event Dispatcher 8

Class ViewsQuerySubstitutionEvent.

@package Drupal\hook_event_dispatcher\Event\Views

Hierarchy

Expanded class hierarchy of ViewsQuerySubstitutionsEvent

3 files declare their use of ViewsQuerySubstitutionsEvent
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/ViewsQuerySubstitutionsEvent.php, line 12

Namespace

Drupal\hook_event_dispatcher\Event\Views
View source
final class ViewsQuerySubstitutionsEvent extends BaseViewsEvent {

  /**
   * Views query substitutions.
   *
   * @var array
   */
  private $substitutions = [];

  /**
   * Set the query substitutions.
   *
   * @param array $substitutions
   *   An associative array where each key is a string to be replaced, and the
   *   corresponding value is its replacement. The strings to replace are often
   *   surrounded with '***', as illustrated in the example implementation, to
   *   avoid collisions with other values in the query.
   */
  public function setSubstitutions(array $substitutions) {
    $this->substitutions = $substitutions;
  }

  /**
   * Get the query substitutions.
   *
   * @return array
   *   An associative array where each key is a string to be replaced, and the
   *   corresponding value is its replacement. The strings to replace are often
   *   surrounded with '***', as illustrated in the example implementation, to
   *   avoid collisions with other values in the query.
   */
  public function &getSubstitutions() {
    return $this->substitutions;
  }

  /**
   * Get the dispatcher type.
   *
   * @return string
   *   The dispatcher type.
   */
  public function getDispatcherType() {
    return HookEventDispatcherInterface::VIEWS_QUERY_SUBSTITUTIONS;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
BaseViewsEvent::$view private property The view.
BaseViewsEvent::getView public function Get the view.
BaseViewsEvent::__construct public function ViewsPreExecuteEevent constructor. 3
ViewsQuerySubstitutionsEvent::$substitutions private property Views query substitutions.
ViewsQuerySubstitutionsEvent::getDispatcherType public function Get the dispatcher type. Overrides EventInterface::getDispatcherType
ViewsQuerySubstitutionsEvent::getSubstitutions public function Get the query substitutions.
ViewsQuerySubstitutionsEvent::setSubstitutions public function Set the query substitutions.