public function DefaultFacetManager::getFacetsByFacetSourceId in Facets 8
Returns currently rendered facets filtered by facetsource ID.
Parameters
string $facetsource_id: The facetsource ID to filter by.
Return value
\Drupal\facets\FacetInterface[] An array of enabled facets.
2 calls to DefaultFacetManager::getFacetsByFacetSourceId()
- DefaultFacetManager::alterQuery in src/
FacetManager/ DefaultFacetManager.php - Allows the backend to add facet queries to its native query object.
- DefaultFacetManager::updateResults in src/
FacetManager/ DefaultFacetManager.php - Updates all facets of a given facet source with the results.
File
- src/
FacetManager/ DefaultFacetManager.php, line 139
Class
- DefaultFacetManager
- The facet manager.
Namespace
Drupal\facets\FacetManagerCode
public function getFacetsByFacetSourceId($facetsource_id) {
// Immediately initialize the facets.
$this
->initFacets();
$facets = [];
foreach ($this->facets as $facet) {
if ($facet
->getFacetSourceId() === $facetsource_id) {
$facets[] = $facet;
}
}
return $facets;
}