You are here

final class ViewsDataEvent in Hook Event Dispatcher 8

Class ViewsDataEvent.

Hierarchy

Expanded class hierarchy of ViewsDataEvent

2 files declare their use of ViewsDataEvent
hook_event_dispatcher.module in ./hook_event_dispatcher.module
Hook event dispatcher module.
ViewDataEventTest.php in tests/src/Unit/Views/ViewDataEventTest.php

File

src/Event/Views/ViewsDataEvent.php, line 12

Namespace

Drupal\hook_event_dispatcher\Event\Views
View source
final class ViewsDataEvent extends Event implements EventInterface {

  /**
   * New views data.
   *
   * @var array
   */
  private $data = [];

  /**
   * Add data to the views data.
   *
   * @param array $data
   *   Data to add to the views data.
   *
   * @see \hook_views_data()
   */
  public function addData(array $data) {
    $this->data = \array_merge_recursive($this->data, $data);
  }

  /**
   * Get data.
   *
   * @return array
   *   Data.
   */
  public function getData() {
    return $this->data;
  }

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

}

Members

Namesort descending Modifiers Type Description Overrides
ViewsDataEvent::$data private property New views data.
ViewsDataEvent::addData public function Add data to the views data.
ViewsDataEvent::getData public function Get data.
ViewsDataEvent::getDispatcherType public function Get the dispatcher type. Overrides EventInterface::getDispatcherType