| 5 core.php | hook_link_alter(&$node, &$links) |
| 6 core.php | hook_link_alter(&$links, $node, $comment = NULL) |
Perform alterations before links on a node are rendered. One popular use of this hook is to modify/remove links from other modules. If you want to add a link to the links section of a node, use hook_link instead.
Parameters
$node: A node object for editing links on
$links: Nested array of links for the node
Return value
None.
Related topics
3 invocations of hook_link_alter()
File
- developer/
hooks/ core.php, line 647 - These are the hooks that are invoked by the Drupal core.
Code
function hook_link_alter(&$node, &$links) {
foreach ($links as $module => $link) {
if (strstr($module, 'taxonomy_term')) {
// Link back to the forum and not the taxonomy term page
$links[$module]['href'] = str_replace('taxonomy/term', 'forum', $link['href']);
}
}
}
Login or register to post comments