You are here

public function Generic::prepareQuery in Core Views Facets 8

Same name in this branch
  1. 8 src/Plugin/facets/processor/contextual_filter_type/Generic.php \Drupal\core_views_facets\Plugin\facets\processor\contextual_filter_type\Generic::prepareQuery()
  2. 8 src/Plugin/facets/processor/exposed_filter_type/Generic.php \Drupal\core_views_facets\Plugin\facets\processor\exposed_filter_type\Generic::prepareQuery()

Alters the facet query before execution.

Parameters

\Drupal\views\ViewExecutable $view: The views executable the facet applies to.

\Drupal\views\Plugin\views\HandlerBase $handler: The loaded views contextual filter handler.

\Drupal\facets\FacetInterface $facet: The facet being executed.

Return value

null|\Drupal\Core\Database\Query\Select The altered query object to be executed.

Overrides CoreViewsFacetsFilterType::prepareQuery

File

src/Plugin/facets/processor/contextual_filter_type/Generic.php, line 24

Class

Generic
A generic filter type for core views.

Namespace

Drupal\core_views_facets\Plugin\facets\processor\contextual_filter_type

Code

public function prepareQuery(ViewExecutable $view, HandlerBase $handler, FacetInterface $facet) {
  try {
    return parent::prepareQuery($view, $handler, $facet);
  } catch (\Exception $e) {
    watchdog_exception('facets', $e, t('The core_views_facets module tried at least once to generically handle the unknown views filter type %filter_type and failed.'), [
      '%filter_type' => $handler->pluginId,
    ], RfcLogLevel::NOTICE);
    return NULL;
  }
}