[development] hooks after hook_menu CALLBACKS called, but before page rendered

_craig drupal-list at 2craig.com
Thu Oct 19 03:16:59 UTC 2006


> You could always do it in template.php. 

Thanks for the suggestion!  I hadn't thought of that.  However, I am really
trying to keep everything encapsulated in a module without requiring users
of the module to change a theme or patch core.  

I did have one thought but quickly discounted it figuring it would make for
REALLY ugly hack:

1. Give the taxonomy_breadcrumb module a weight such that it's hook_menu
gets called last.
2. Access the global menu object (hack!) and overwrite each callback with my
own (hack!!).  I'd make the first callback argument the "real" callback
function's name and use arguments 2 - N+1 to contain the original N
arguments used by the original callback.
3. In my callback that would ALWAYS get called, I'd then look at the first
argument to find the "real" callback to call, and then pass the rest on to
the function indicated by the first.  Following return to my callback
function I'd then be able to do whatever I wanted to the page and be assured
I was the last to have control of the breadcrumbs (and anything else on the
page).

Perhaps it would be better to try and get a new hook put into core?  Being
relatively new to drupal I'm not sure of the process or historical context
of adding hooks to core.  Do I simply write an issue and submit a patch--now
or after 5.0 is released?  Do I need to drum up support for it?




More information about the development mailing list