I keep having problems with users reporting conflicts with Contemplate and my implementation of hook_link_alter in Statistics Advanced. I looked through the latest 6.x-1.x code for Contemplate again today and confirmed that it is incorrect. You can clearly see from the current D6 documentation for node_view and hook_link_alter that parameter order should be $links, then $node. This is different from the D5 implentation which is the reverse ($node, then $links). However, currently Contemplate passes $node, then $links.
Current code in 6.x-1.x contemplate.module:
function contemplate_node_view()
...
if ($links) {
$node->links = module_invoke_all('link', 'node', $node, !$page);
foreach (module_implements('link_alter') AS $module) {
$function = $module .'_link_alter';
$function($node, $node->links);
}
}
...
And it should be:
function contemplate_node_view()
...
if ($links) {
$node->links = module_invoke_all('link', 'node', $node, !$page);
drupal_alter('link', $node->links, $node);
}
...
Attached patch against current 6.x-1.x that fixes the parameter order and uses drupal_alter, which is the preferred implementation in core (see the link to node_view above).
| Comment | File | Size | Author |
|---|---|---|---|
| contemplate-link-alter-D6.patch | 824 bytes | dave reid |
Comments
Comment #1
eMPee584 commentedCommitted, thx ;)
Comment #2
dave reidThanks very much eMPee584!