You are here

protected function FacetapiUrlProcessorSession::getSession in Facet API Bonus 7

Get the namespaced session variable.

1 call to FacetapiUrlProcessorSession::getSession()
FacetapiUrlProcessorSession::fetchParams in modules/facetapi_bonus_session/includes/facetapi/url_processor_session.inc
Implements FacetapiUrlProcessor::fetchParams().

File

modules/facetapi_bonus_session/includes/facetapi/url_processor_session.inc, line 74
A facet handler that falls back onto session set variables.

Class

FacetapiUrlProcessorSession
Url processor plugin that retrieves facet data from the query string.

Code

protected function &getSession() {
  $namespace = self::getNamespace();

  // If we have a namespace, return the session variable by reference.
  if ($namespace) {

    // We also namespace by adapter to prevent un-wanted crossover.
    if (!isset($_SESSION['facetapi']['url_processor_session'][$this->adapter
      ->getSearcher()][$namespace])) {
      $_SESSION['facetapi']['url_processor_session'][$this->adapter
        ->getSearcher()][$namespace] = array();
    }
    return $_SESSION['facetapi']['url_processor_session'][$this->adapter
      ->getSearcher()][$namespace];
  }

  // Otherwise create a variable we can return by reference.
  $session = array();
  return $session;
}