You are here

public function CoreViewsExposedFilter::getViewsFilterDefinition in Core Views Facets 8

Retrieve the filter definition from the current view.

Parameters

string|null $filter_id: The string ID of a filter.

Return value

\Drupal\views\Plugin\views\filter\FilterPluginBase|bool An array with the definition of the filter, or FALSE when the plugin doesn't exist.

File

src/Plugin/facets/facet_source/CoreViewsExposedFilter.php, line 229

Class

CoreViewsExposedFilter
Represents a facet source of the core views with exposed filters.

Namespace

Drupal\core_views_facets\Plugin\facets\facet_source

Code

public function getViewsFilterDefinition($filter_id = NULL) {
  if (empty($filter_id) || empty($this->view)) {
    return FALSE;
  }

  /** @var \Drupal\views\Plugin\views\filter\FilterPluginBase $filter */
  $filter = $this->view
    ->getHandler($this->pluginDefinition['view_display'], 'filter', $filter_id);
  return $filter ?: FALSE;
}