function ajax_facets_facet_build_apply_path in Ajax facets 7.2
Same name and namespace in other branches
- 7 ajax_facets.module \ajax_facets_facet_build_apply_path()
Return Drupal formed url for apply current facets state.
1 call to ajax_facets_facet_build_apply_path()
- ajax_facets_refresh_facets_content in ./ajax_facets.pages.inc 
- Callback to update facets content by AJAX.
File
- ./ajax_facets.module, line 130 
- Ajax facets implementation.
Code
function ajax_facets_facet_build_apply_path($adapter) {
  $params = $adapter
    ->getUrlProcessor()
    ->fetchParams();
  $unset_keys = array(
    'searchPath',
    'q',
    'page',
  );
  // Remove default params from redirect.
  foreach ($unset_keys as $key) {
    if (isset($params[$key])) {
      unset($params[$key]);
    }
  }
  // Remove empty filter key.
  $filter_key = $adapter
    ->getUrlProcessor()
    ->getFilterKey();
  if (isset($params[$filter_key]) && empty($params[$filter_key])) {
    unset($params[$filter_key]);
  }
  $url_params = !empty($params) ? array(
    'query' => $params,
  ) : array();
  return url(!empty($_GET['searchPath']) ? $_GET['searchPath'] : $adapter
    ->getSearchPath(), $url_params);
}