You are here

function search_api_facetapi_current_search_path in Search API 7

Helper function that statically stores the Search API's base path. Can either be used to store or retrieve the base path.

This static store is used in SearchApiFacetapiAdapter::getSearchPath() in order to retrieve the current search base path. Just relying on search_api_current_search() to retrieve the current query is not enough, as the path might be requested before the query is finally executed and stored.

Parameters

SearchApiQueryInterface $query: When storing the base base, the query that is executed. Else NULL.

Return value

The Search API's base path.

2 calls to search_api_facetapi_current_search_path()
SearchApiFacetapiAdapter::getSearchPath in contrib/search_api_facetapi/plugins/facetapi/adapter.inc
Overrides FacetapiAdapter::getSearchPath().
search_api_facetapi_search_api_query_alter in contrib/search_api_facetapi/search_api_facetapi.module
Implements hook_search_api_query_alter().

File

contrib/search_api_facetapi/search_api_facetapi.module, line 288
Integrates the Search API with the Facet API.

Code

function search_api_facetapi_current_search_path(SearchApiQueryInterface $query = NULL) {
  $path =& drupal_static(__FUNCTION__, '');
  if ($query && $query
    ->getOption('search_api_base_path')) {
    $path = $query
      ->getOption('search_api_base_path');
  }
  return $path;
}