You are here

public function PopulateRemoveEmptyFilterMock::preQuery in Views filters populate 8

Run before the view is built.

This gives all the handlers some time to set up before any handler has been fully run.

Overrides HandlerBase::preQuery

File

src/Plugin/views/filter/Populate.php, line 23

Class

PopulateRemoveEmptyFilterMock
Filter mock class that takes care of removing populated filters from the view if the populated value is empty and exposed.

Namespace

Drupal\views_filters_populate\Plugin\views\filter

Code

public function preQuery() {
  $handler = $this->views_filters_populate_handler_caller;
  foreach ($handler->options['filters'] as $id) {
    unset($handler->view->filter[$id]);
  }
  foreach ($handler->view->filter as $k => $filter) {
    if ($filter === $this) {
      unset($handler->view->filter[$k]);
    }
  }
}