You are here

class FacetApiPrettyPathsCoderTaxonomy in Facet API Pretty Paths 7

Same name and namespace in other branches
  1. 6.3 plugins/coders/facetapi_pretty_paths_coder_taxonomy.inc \FacetApiPrettyPathsCoderTaxonomy

Taxonomy specific implementation of FacetApiPrettyPathsCoder.

Hierarchy

Expanded class hierarchy of FacetApiPrettyPathsCoderTaxonomy

1 string reference to 'FacetApiPrettyPathsCoderTaxonomy'
facetapi_pretty_paths_facetapi_pretty_paths_coders in ./facetapi_pretty_paths.module
Implements hook_facetapi_pretty_paths_coders().

File

plugins/coders/facetapi_pretty_paths_coder_taxonomy.inc, line 11
A taxonomy specific coder for pretty paths.

View source
class FacetApiPrettyPathsCoderTaxonomy extends FacetApiPrettyPathsCoderDefault {

  /**
   * Taxonomy special case: <alias>/<term-name>-<term-id>
   *
   * @see FacetApiPrettyPathsCoderDefault::encodePathSegment()
   */
  public function encodePathSegment(array $args) {
    if ($term = taxonomy_term_load($args['segment']['value'])) {
      $args['segment']['value'] = $this
        ->prettyPath($term->name) . '-' . $term->tid;
    }
    return parent::encodePathSegment($args);
  }

  /**
   * Taxonomy special case: <alias>/<term-name>-<term-id>
   *
   * @see FacetApiPrettyPathsCoderDefault::decodePathSegmentValue()
   */
  public function decodePathSegmentValue(array $args) {
    $exploded = explode('-', $args['value']);
    $args['value'] = array_pop($exploded);
    return parent::decodePathSegmentValue($args);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
FacetApiPrettyPathsCoderDefault::decodePathSegmentAlias public function Decode the alias part of a path segment in order to interpret it from a given pretty path.
FacetApiPrettyPathsCoderDefault::prettyPath protected function Convert a given text to a pretty path using pathauto, if available.
FacetApiPrettyPathsCoderTaxonomy::decodePathSegmentValue public function Taxonomy special case: <alias>/<term-name>-<term-id> Overrides FacetApiPrettyPathsCoderDefault::decodePathSegmentValue
FacetApiPrettyPathsCoderTaxonomy::encodePathSegment public function Taxonomy special case: <alias>/<term-name>-<term-id> Overrides FacetApiPrettyPathsCoderDefault::encodePathSegment