public function FacetapiUrlProcessorStandard::getQueryString in Facet API 6.3
Same name and namespace in other branches
- 7.2 plugins/facetapi/url_processor_standard.inc \FacetapiUrlProcessorStandard::getQueryString()
- 7 plugins/facetapi/url_processor_standard.inc \FacetapiUrlProcessorStandard::getQueryString()
Implements FacetapiUrlProcessor::getQueryString().
Overrides FacetapiUrlProcessor::getQueryString
File
- plugins/
facetapi/ url_processor_standard.inc, line 65 - The standard URL processor.
Class
- FacetapiUrlProcessorStandard
- Extension of FacetapiUrlProcessor.
Code
public function getQueryString(array $facet, array $values, $active) {
$qstring = $this->params;
$active_items = $this->adapter
->getActiveItems($facet);
// Appends to qstring if inactive, removes if active.
foreach ($values as $value) {
if ($active && isset($active_items[$value])) {
unset($qstring[$this->filterKey][$active_items[$value]['pos']]);
}
elseif (!$active) {
$field_alias = rawurlencode($facet['field alias']);
$qstring[$this->filterKey][] = $field_alias . ':' . $value;
}
}
// Removes duplicates, resets array keys and returns query string.
// @see http://drupal.org/node/1340528
$qstring[$this->filterKey] = array_values(array_unique($qstring[$this->filterKey]));
return array_filter($qstring);
}