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).

CommentFileSizeAuthor
contemplate-link-alter-D6.patch824 bytesdave reid

Comments

eMPee584’s picture

Status: Needs review » Fixed

Committed, thx ;)

dave reid’s picture

Thanks very much eMPee584!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.