public function FacetApiPrettyPathsCoderTaxonomyPathauto::encodePathSegment in Facet API Pretty Paths 7
Taxonomy pathauto special case: <facet alias>/<term-name alias>
Overrides FacetApiPrettyPathsCoderDefault::encodePathSegment
See also
FacetApiPrettyPathsCoderDefault::encodePathSegment()
File
- plugins/
coders/ facetapi_pretty_paths_coder_taxonomy_pathauto.inc, line 24 - A taxonomy specific coder based on path aliases of terms.
Class
- FacetApiPrettyPathsCoderTaxonomyPathauto
- Taxonomy pathauto specific implementation of FacetApiPrettyPathsCoder.
Code
public function encodePathSegment(array $args) {
$voc_alias = $this
->getVocabularyPathAlias($args['facet'], $args['adapter']);
if ($voc_alias) {
if ($term = taxonomy_term_load($args['segment']['value'])) {
// Get the alias ([term:vocabulary]/[term:name]) for this term and
// extract the term:name part.
$alias = drupal_lookup_path('alias', 'taxonomy/term/' . $term->tid);
if ($alias) {
$parts = explode('/', $alias);
if (count($parts) == 2) {
$args['segment']['value'] = $parts[1];
}
}
}
}
return parent::encodePathSegment($args);
}