Hi
How would you set this to
for different content types please?

/**
 * Implementation of hook_entity_info_alter().
 *
 * Redirect any links to program taxonomy terms to their corresponding node page.
 */
function termspath_entity_info_alter(&$entity_info) {
  $entity_info['taxonomy_term']['uri callback'] = 'termspath_taxonomy_term_uri';
}
/**
 * Entity uri callback for taxonomy terms. Add special exception to redirect users away 
 * from taxonomy term pages to the associated program node page.
 */

/**
 *For car content types
 */

function termspath_taxonomy_term_uri($term) {
    return array('path' => 'cars/colors/' . $term->tid);
}

/**
 *For motorbikes  content types
 */

function termspath_taxonomy_term_uri($term) {
    return array('path' => 'motorbikes/colors/' . $term->tid);
}

Many thanks for your help

Comments

Jaypan’s picture

charlie charles’s picture

Sorry it was unclear and Thank you for your feedback.

I have two content types for example we're say cars and bikes...
Both share the same taxonomy i.e colors...
When someone viewing the cars nodetypes clicks on tag term "red"...

this takes them to a contextual views filter mysite.com/cars/red i.e contextual views page path cars/%...

For this to work I have to add the content type before the terms path
i.e 'path' => 'motorbikes/"term name"' for terms on the motorbikes content type

and 'path' => 'cars/"term name"' for terms on the cars content type.

How do I assign these two function to their content node types please?

Many thanks for your help

/**
 * Entity uri callback for taxonomy terms. Add special exception to redirect users away
 * from taxonomy term pages to the associated program node page.
 */
/**
 *For car content types
 */
function termspath_taxonomy_term_uri($term) {
    return array('path' => 'cars/colors/' . $term->tid);
}
/**
 *For motorbikes  content types
 */
function termspath_taxonomy_term_uri($term) {
    return array('path' => 'motorbikes/colors/' . $term->tid);
}