fieke
9/27/2013 - 12:21 PM

Add back to overview link in taxonomy view

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;
  }
}