You are here

protected function QueryString::getUrlAliasByFacetId in Facets 8

Gets the url alias from the facet id & facet source id.

Parameters

string $facet_id: The facet id.

string $facet_source_id: The facet source id.

Return value

bool|string Either the url alias, or FALSE if that can't be loaded.

1 call to QueryString::getUrlAliasByFacetId()
QueryString::buildUrls in src/Plugin/facets/url_processor/QueryString.php
Adds urls to the results.

File

src/Plugin/facets/url_processor/QueryString.php, line 389

Class

QueryString
Query string URL processor.

Namespace

Drupal\facets\Plugin\facets\url_processor

Code

protected function getUrlAliasByFacetId($facet_id, $facet_source_id) {
  $mapping =& drupal_static(__FUNCTION__);
  if (!isset($mapping[$facet_source_id][$facet_id])) {
    $storage = $this->entityTypeManager
      ->getStorage('facets_facet');
    $facet = current($storage
      ->loadByProperties([
      'id' => $facet_id,
      'facet_source_id' => $facet_source_id,
    ]));
    if (!$facet) {
      return FALSE;
    }
    $mapping[$facet_source_id][$facet_id] = $facet
      ->getUrlAlias();
  }
  return $mapping[$facet_source_id][$facet_id];
}