You are here

public function ApacheSolrFacetapiAdapter::getPath in Apache Solr Search 8

Same name and namespace in other branches
  1. 6.3 plugins/facetapi/adapter.inc \ApacheSolrFacetapiAdapter::getPath()
  2. 7 plugins/facetapi/adapter.inc \ApacheSolrFacetapiAdapter::getPath()

Returns the path to the admin settings for a given realm.

Parameters

string $realm_name: The name of the realm.

Return value

string The path to the admin settings.

File

plugins/facetapi/adapter.inc, line 22
Classes used by the Facet API module.

Class

ApacheSolrFacetapiAdapter
Facet API adapter for the Apache Solr Search Integration module.

Code

public function getPath($realm_name) {
  $path = 'admin/config/search/apachesolr/settings';

  // $adapter will be an instance of class FacetapiAdapter
  if ($adapter = menu_get_object('facetapi_adapter', 4)) {

    // Get the environment ID from the machine name of the searcher.
    $env_id = ltrim(strstr($adapter
      ->getSearcher(), '@'), '@');
    $path .= '/' . $env_id . '/facets';

    // Add the realm name to the path if it is not the first one in the list.
    if (key(facetapi_get_realm_info()) != $realm_name) {
      $path .= '/' . $realm_name;
    }
  }
  return $path;
}