Skip to content

Instantly share code, notes, and snippets.

@gabesullice
Created April 16, 2014 18:54
Show Gist options
  • Save gabesullice/10920314 to your computer and use it in GitHub Desktop.
Save gabesullice/10920314 to your computer and use it in GitHub Desktop.
/**
* Implements hook_menu_alter()
*
* Swaps out default taxonomy page callback to use a custom callback.
*
* @param $items
*
* @see og_vocab_grid_taxonomy_term_page().
*/
function og_vocab_grid_menu_alter(&$items) {
$items['taxonomy/term/%taxonomy_term']['page callback'] = 'og_vocab_grid_taxonomy_term_page';
}
/**
* Custom page callback that returns only the full view of the term if it is a
* member of an OG vocabulary or, if it is not, the default taxonomy term page
* (with node listings).
*
* @param $term
* @return array
*
* @see taxonomy_term_page().
*/
function og_vocab_grid_taxonomy_term_page($term) {
if (SOME CONDITION)) {
$build = taxonomy_term_view($term, 'full');
}
else {
$build = taxonomy_term_page($term);
}
return $build;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment