You are here

function taxonomy_facets_get_selected_filters in Taxonomy Facets 8

Same name and namespace in other branches
  1. 7.2 taxonomy_facets.module \taxonomy_facets_get_selected_filters()
3 calls to taxonomy_facets_get_selected_filters()
MenuLeaf::__construct in src/MenuLeaf.php
MenuTree::__construct in src/MenuTree.php
TaxonomyFacetsController::content in src/Controller/TaxonomyFacetsController.php

File

./taxonomy_facets.module, line 27

Code

function taxonomy_facets_get_selected_filters($taxo_facets_path = null) {
  $filters =& drupal_static(__FUNCTION__);
  if (!isset($filters)) {
    if ($taxo_facets_path) {
      $taxo_facets_path = explode(':', $taxo_facets_path);
    }
    else {
      $taxo_facets_path = \Drupal::request()
        ->getRequestUri();
      $taxo_facets_path = explode('/', $taxo_facets_path);
      if ($taxo_facets_path[1] === 'listings') {
        array_splice($taxo_facets_path, 0, 2);
      }
      else {
        $taxo_facets_path = null;
        if ($taxo_facets_path = \Drupal::request()
          ->get('taxonomy_facets')) {
          $taxo_facets_path = explode('/', $taxo_facets_path);
        }
      }
    }
    if ($taxo_facets_path) {
      $filters = new \Drupal\taxonomy_facets\SelectedFilters($taxo_facets_path);
    }
    else {
      $filters = null;
    }
  }
  return $filters;
}