Skip to content

Instantly share code, notes, and snippets.

@mcjwsk
Created July 22, 2015 08:26
Show Gist options
  • Save mcjwsk/52333de670c083e01c35 to your computer and use it in GitHub Desktop.
Save mcjwsk/52333de670c083e01c35 to your computer and use it in GitHub Desktop.
name = Taxonomy page
description = Override taxonomy term page.
package = Custom
version = 7.x-1.0
core = 7.x
dependencies[] = taxonomy
<?php
/**
* @file
* Main module file.
*/
/**
* Implements hook_menu_alter().
*/
function taxonomy_page_menu_alter(&$items) {
$items['taxonomy/term/%taxonomy_term']['page callback'] = 'taxonomy_page_view';
$items['taxonomy/term/%taxonomy_term']['page arguments'] = array(2);
$items['taxonomy/term/%taxonomy_term']['file'] = 'taxonomy_page.pages.inc';
$items['taxonomy/term/%taxonomy_term']['file path'] = drupal_get_path('module', 'taxonomy_page');
if (isset($items['taxonomy/term/%taxonomy_term']['module'])) {
unset($items['taxonomy/term/%taxonomy_term']['module']);
}
if (isset($items['taxonomy/term/%'])) {
unset($items['taxonomy/term/%']);
}
}
<?php
/**
* @file
* Menu callbacks.
*/
/**
* Taxonomy term page callback.
*/
function taxonomy_page_view($term) {
$vocabulary_name = $term->vocabulary_machine_name;
switch ($vocabulary_name) {
/*
case 'collections':
return views_embed_view('collections', 'block', $term->tid);
break;
*/
default:
return taxonomy_term_page($term);
break;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment