Skip to content

Instantly share code, notes, and snippets.

@fieke
Created September 27, 2013 12:21
Show Gist options
  • Save fieke/6727804 to your computer and use it in GitHub Desktop.
Save fieke/6727804 to your computer and use it in GitHub Desktop.
Add back to overview link in taxonomy view
/**
* Implements hook_taxonomy_term_view().
*/
function theme_taxonomy_term_view($term, $view_mode, $langcode) {
switch ($term->vid) {
case '2':
// Create return to overview-link
$path = request_path();
$path = explode('/', $path);
// if we are on the deepest level (the third, unless someone has been fucking with the setup)
// create a link to a level higher
if (count($path) > 1) {
array_pop($path);
$term->content['return_to_overview']['#markup'] = l(t('Return to overview'), implode('/', $path), array('attributes' => array('class' => array('backlink'), 'title' => t('Return to overview'))));
}
break;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment