Skip to content

Instantly share code, notes, and snippets.

@kyleskrinak
Forked from jekamozg/content_recipe.module
Last active August 29, 2015 14:05
Show Gist options
  • Save kyleskrinak/ac17e3c5cba08dc1e783 to your computer and use it in GitHub Desktop.
Save kyleskrinak/ac17e3c5cba08dc1e783 to your computer and use it in GitHub Desktop.
/**
* Implementation of hook_entity_info_alter().
*
* Redirect any links to groups taxonomy terms to their corresponding node
* page.
*/
function term_redirect_entity_info_alter(&$entity_info) {
$entity_info['taxonomy_term']['uri callback'] = 'term_redirect_taxonomy_term_uri';
}
/**
* Entity uri callback for taxonomy terms. Add special exception to redirect
* users away from taxonomy term pages to the associated calendar view for
* term
*/
function term_redirect_taxonomy_term_uri($term) {
if ('vocabulary_2' == $term->vocabulary_machine_name) {
return array(
'path' => 'calendar', //?tid[]=' . $term->tid,
'options' => array('query' => array('tid[]'=>$term->tid)),
);
} else {
return array(
'path' => 'taxonomy/term/' . $term->tid,
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment