Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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.
Comment | File | Size | Author |
---|---|---|---|
statistics.module.patch | 808 bytes | Darren Oh | |
Comments
Comment #1
Dave ReidLooks good and works locally.
Comment #2
Gábor HojtsySo 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?
Comment #3
Darren OhThe 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!