#197864 by vito_swat, alpritt, Murz, catch: Use hook_term_path() in forum module instead of hook_link_alter(); simplfies code, improves performance and compatibility.

5.x
Neil Drumm 2009-04-29 18:53:38 +00:00
parent 8b2d04f365
commit 3a4912c843
1 changed files with 2 additions and 12 deletions

View File

@ -645,18 +645,8 @@ function _forum_parent_select($tid, $title, $child_type) {
return array('#type' => 'select', '#title' => $title, '#default_value' => $parent, '#options' => $options, '#description' => $description, '#required' => TRUE); return array('#type' => 'select', '#title' => $title, '#default_value' => $parent, '#options' => $options, '#description' => $description, '#required' => TRUE);
} }
function forum_link_alter(&$node, &$links) { function forum_term_path($term) {
foreach ($links as $module => $link) { return 'forum/'. $term->tid;
if (strstr($module, 'taxonomy_term')) {
// Link back to the forum and not the taxonomy term page. We'll only
// do this if the taxonomy term in question belongs to forums.
$tid = str_replace('taxonomy/term/', '', $link['href']);
$term = taxonomy_get_term($tid);
if ($term->vid == _forum_get_vid()) {
$links[$module]['href'] = str_replace('taxonomy/term', 'forum', $link['href']);
}
}
}
} }
/** /**