Some modules may have a need to override the links provided by another module. Here are a couple of scenarios where this would be necessary.
The image.module provides links to view various sizes of the image (e.g., small, medium, large). A fancy gallery wants to provide access control for each image size and it must hide/remove links for image sizes which the user is unable to view.
The project.module allows users to "follow up" to issues. Followups are much more than a simple comment because they can include issue status changes and file attachments. However, the project.module wants to leverage comment.module (instead of requiring its own special code and tables) to handle issue comments/followups but still provide a "follow up" (or other) link instead of the "add a new comment" link provided by comment.module.
Perhaps this request runs counter to the idea of hooks. I am not aware of any other hooks which can be overriden but perhaps there are some. Despite this, I think the need to override links and similar needs (like ordering them by weight as discussed in http://drupal.org/node/48770) will be more necessary as modules extend each other.
Comments
Comment #1
markus_petrux commentedMaybe if the $links array was an associative array? ...but then that would depend on the order modules are invoked to process hook_link.
hmm... maybe the best solution is implement something in such a way that modules can publish links and the user can choose which to show, the order, etc. Like menus or blocks.
I think we could mix up both issues, as they may end up on the same solution.
Comment #2
chx commentedhttp://drupal.org/node/18260
Comment #3
tangent commentedThanks chx. I performed multiple searches on this subject but came up with nothing for some reason.
Comment #4
markus_petrux commentedOh, I missed that issue too.