| Versionen | |
|---|---|
| drupal6 | hook_link_alter(&$links, $node, |
| drupal7 | hook_link_alter(array &$links, $node) |
Perform alterations before links on a node or comment 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 or comment, use hook_link() instead.
$links Nested array of links for the node or comment keyed by providing module.
$node A node object.
$comment An optional comment object if the links are comment links. If not provided, the links are node links.
developer-docs/
<?php
function hook_link_alter(&$links, $node, $comment = NULL) {
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']);
}
}
}
?>
Kommentare
Kommentar hinzufügen