[drupal-devel] [feature] Allow overriding of links returned by modules

kbahey drupal-devel at drupal.org
Thu Mar 3 14:20:16 UTC 2005

Issue status update for http://drupal.org/node/18260

 Project:      Drupal
 Version:      cvs
 Component:    base system
 Category:     feature requests
 Priority:     normal
 Assigned to:  Anonymous
 Reported by:  kbahey
 Updated by:   kbahey
-Status:       active
+Status:       patch

Setting status to patch, so we get it to the developers mailing list,
and have a discussion going.


Previous comments:

March 2, 2005 - 10:23 : kbahey

It is apparent that links returned by various modules need to often be
changed to a different text, or disabled all together. 
For example, the issue of an Option to disable printer friendly version
for book module [1], or for when using image.module to add product with
image [2], or in let _link() return structured link info [3]. 
All these issues point for a desire to modify or disable various links
in various modules.
Crude Solution:
One solution was to push this in every module out there, where each
module would have options that would display or disable certain links.
This is not the most elegant solution, since every module out there
needs to change, and have options and more options.
A Better Solution:
A better approach is to allow the l() call to do a lookup in a table in
the database (e.g. links). The links table would have module identifier,
the original link text, and new link text.
A user interface (mainly for the site admin) can provide a drop down
list for all modules enabled, and allows overriding the text of the
link, or disabling it altogether. 
Now when a module calls l(), it will lookup each link in the above
table (or in the cache), and change them or disable them as
This would work with all modules, provided they do use the l() call,
and not create the link by hand.
Some potential issues:
- More database access. However this is lessened somewhat by caching.
- Ideally modules should have someway of answering a call to "list all
links you have", and this can be used to populate the database when a
module is enabled. This does not exist today, and I have no idea how
feasible/easy/hard it is. Also, if modules are upgraded, how would
Drupal know to update that table? By file timestamp for example which
is kept?
Please feel free to comment, refine, ...etc.
[1] http://drupal.org/node/13211
[2] http://drupal.org/node/18249
[3] http://drupal.org/node/636

More information about the drupal-devel mailing list