Created
September 27, 2013 12:21
-
-
Save fieke/6727804 to your computer and use it in GitHub Desktop.
Add back to overview link in taxonomy view
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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