public function DefaultFacetManager::alterQuery in Facets 8
Allows the backend to add facet queries to its native query object.
This method is called by the implementing module to initialize the facet display process.
Parameters
mixed $query: The backend's native query object.
string $facetsource_id: The facet source ID to process.
File
- src/
FacetManager/ DefaultFacetManager.php, line 111
Class
- DefaultFacetManager
- The facet manager.
Namespace
Drupal\facets\FacetManagerCode
public function alterQuery(&$query, $facetsource_id) {
/** @var \Drupal\facets\FacetInterface[] $facets */
foreach ($this
->getFacetsByFacetSourceId($facetsource_id) as $facet) {
/** @var \Drupal\facets\QueryType\QueryTypeInterface $query_type_plugin */
$query_type_plugin = $this->queryTypePluginManager
->createInstance($facet
->getQueryType(), [
'query' => $query,
'facet' => $facet,
]);
$query_type_plugin
->execute();
}
}