When a module invokes hook_link() for a non-node object, statistics_link() generates an error notice. This is because CVS commit 2741 made statistics_link() try to return links for everything but comments. The stated purpose was to support all node types, but as far as I can tell, it is unnecessary.

This is not a problem for Drupal 7.

CommentFileSizeAuthor
statistics.module.patch808 bytesDarren Oh
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Dave Reid’s picture

Status: Needs review » Reviewed & tested by the community

Looks good and works locally.

Gábor Hojtsy’s picture

Status: Reviewed & tested by the community » Fixed

So it is not a problem on Drupal 7, because the code is in statistics_node_view() and thus is only ever invoked for nodes. There is no condition on comments there. In Drupal 6, however, http://api.drupal.org/api/function/hook_link/6 says there should only ever be 'comment' and 'node' passed in hook_link's $type, so != 'comment' and == 'node' should be identical according to code docs. If it is called with other $types, we have a docs issue here.

Anyway, checking for == 'node' is cleaner, so I agree this should be cleaned up. Committed.

Why is this an issue for you actually?

Darren Oh’s picture

The documentation says the 'node' and 'comment' are possible values. Those are the only values with which hook_link() is invoked in core. However, contributed modules may add other link types. e-Commerce uses hook_link() to add links to transactions, payments, receipts, and customers. None of these are nodes or comments.

Fixed in CVS commit 203400. Thanks, Gabor!

Status: Fixed » Closed (fixed)

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