public function FacetapiUrlProcessorPrettyPaths::constructPath in Facet API Pretty Paths 7
Same name and namespace in other branches
- 6.3 plugins/facetapi/url_processor_pretty_paths.inc \FacetapiUrlProcessorPrettyPaths::constructPath()
Construct a path from for a given array of filter segments.
Parameters
array $segments:
Return value
string
2 calls to FacetapiUrlProcessorPrettyPaths::constructPath()
- FacetapiUrlProcessorPrettyPaths::getFacetPath in plugins/
facetapi/ url_processor_pretty_paths.inc - Pretty paths will be generated as "search/url/segment1/segment2/".
- FacetapiUrlProcessorPrettyPaths::setBreadcrumb in plugins/
facetapi/ url_processor_pretty_paths.inc - Implements FacetapiUrlProcessorPrettyPaths::setBreadcrumb().
File
- plugins/
facetapi/ url_processor_pretty_paths.inc, line 196 - A custom URL processor for pretty paths.
Class
- FacetapiUrlProcessorPrettyPaths
- Extension of FacetapiUrlProcessor.
Code
public function constructPath(array $segments) {
if (!empty($this->options['sort_path_segments'])) {
// Sort to avoid multiple urls with duplicate content.
uksort($segments, 'strnatcmp');
}
$path = $this
->getBasePath();
// Add all path segments.
foreach ($segments as $key => $segment) {
$this
->encodePathSegment($segment, $segment['facet']);
$path .= '/' . $segment['alias'] . '/' . $segment['value'];
}
return $path;
}