You are here

final class ViewsDataEvent in Hook Event Dispatcher 8.2

Same name and namespace in other branches
  1. 3.x modules/views_event_dispatcher/src/Event/Views/ViewsDataEvent.php \Drupal\views_event_dispatcher\Event\Views\ViewsDataEvent

Class ViewsDataEvent.

Hierarchy

Expanded class hierarchy of ViewsDataEvent

2 files declare their use of ViewsDataEvent
ViewDataEventTest.php in modules/views_event_dispatcher/tests/src/Unit/Views/ViewDataEventTest.php
views_event_dispatcher.module in modules/views_event_dispatcher/views_event_dispatcher.module
Views event dispatcher submodule.

File

modules/views_event_dispatcher/src/Event/Views/ViewsDataEvent.php, line 13

Namespace

Drupal\views_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() : array {
    return $this->data;
  }

  /**
   * Get the dispatcher type.
   *
   * @return string
   *   The dispatcher type.
   */
  public function getDispatcherType() : string {
    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