You are here

public function ExampleViewsEventSubscribers::queryAlter in Hook Event Dispatcher 8

Query alter event handler.

Parameters

\Drupal\hook_event_dispatcher\Event\Views\ViewsQueryAlterEvent $event: The event.

File

src/Example/ExampleViewsEventSubscribers.php, line 63

Class

ExampleViewsEventSubscribers
Class ExampleViewsEventSubscribers.

Namespace

Drupal\hook_event_dispatcher\Example

Code

public function queryAlter(ViewsQueryAlterEvent $event) {
  $query = $event
    ->getQuery();

  // Do something with the query.
  $query
    ->setLimit(10);
}