hook_link_alter is called twice per node; Once for the links section (links like 'read more', normally below the node body), and once for the taxonomy links section (links to terms, normally above the node body). If hook_link_alter is used to add a link, this link to the $links array, this link shows up on both sections. This leads to confusion: http://drupal.org/node/217017. Instead, it is more logical to use hook_link to add a link to the links section.

The api documentation describes hook_link_alter as follows:
Perform alterations before links on a node are rendered. One popular use of this hook is to add/delete links from other modules.
This would be a better description:
Perform alterations before links on a node are rendered. One popular use of this hook is to modify/remove links from other modules.
The description would probably benefit from the following addition:
If you want to add a link to the links section of a node, use hook_link instead.

Comments

heather’s picture

Component: Developer Guide » Correction/Clarification

Changed the component to reflect the new component categorization. See http://drupal.org/node/301443

add1sun’s picture

Project: Documentation » Drupal core
Version: » 7.x-dev
Component: Correction/Clarification » documentation

Moving to queue for API docs.

karschsp’s picture

Issue tags: +Novice

tagging for novice queue.

JamesAn’s picture

Status: Active » Needs review
StatusFileSize
new726 bytes
new840 bytes
new795 bytes

The description in the patch reads:
Perform alterations before links on a node 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, use hook_link instead.

catch’s picture

Status: Needs review » Reviewed & tested by the community

#451272: Rename or remove or do *something* with hook_link() will probably remove hook_link() from Drupal 7, but let's get this in anyway for now. By the way, if you apply for a CVS account, you'll be able commit the Drupal 5 and Drupal 6 core.php patches yourself

dries’s picture

Version: 7.x-dev » 6.x-dev

Committed to CVS HEAD. Lowering version.

gábor hojtsy’s picture

Version: 6.x-dev » 5.x-dev

Committed to the D6 contrib docs core.php file. Moving to D5. Sorry, don't have time to commit to there now, but due to how the components work, this was in the core isssue queue and obscured my view of outstanding issues :)

drumm’s picture

Status: Reviewed & tested by the community » Fixed

Commited to 5.x. Anyone with a contrib cvs account can do this.

Status: Fixed » Closed (fixed)
Issue tags: -Novice

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