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

_craig drupal-list at 2craig.com
Wed Oct 18 21:44:45 UTC 2006


I want the opportunity to affect the breadcrumb trail already set by modules
that used drupal_set_breadcrumb in their menu callbacks.  I want to have a
final say on what the breadcrumb will really be.  

For example, I want to be able to change a breadcrumb that says "Home >>
created >> by >> a >> module" to "example.com >> created >> by >> a >>
module".

Currently taxonomy_breadcrumb works only for nodes and not all paths where
breadcrumbs are shown.  The HEAD version of my module uses hook_nodeapi to
call drupal_set_breadcrumb (hook_menu in 4.7).  This strategy works well for
node types but doesn't get me anywhere for paths that aren't nodes.  This is
why I want an opportunity the module have the "final" say on breadcrumbs
after all menu callbacks have been called (but before "print theme('page',
$return);" in index.php).  Again I'll highlight the distinction I missed
earlier: I specifically mean menu CALLBACKS and not simply hook_menu calls.

Craig


-----Original Message-----
From: development-bounces at drupal.org [mailto:development-bounces at drupal.org]
On Behalf Of Moshe Weitzman
Sent: Wednesday, October 18, 2006 1:15 PM
To: development at drupal.org
Subject: Re: [development] hooks after hook_menu CALLBACKS called, but
before page rendered

_craig wrote:
> Thanks Moshe, Your response made me realize I made a subtle, but key 
> omission in my original question.
> 
> Instead of this:
>> How can I have a function in my module execute after any other 
>> hook_menu's
> have been executed?
> 
> I should have said this:
>> How can I have a function in my module execute after any other 
>> hook_menu
> ** CALLBACKS ** have been executed?
> 
> Also, keep in mind I need my function to be called after callbacks, 
> but BEFORE the page is rendered in the theme (which is why I believe 
> hook_footer doesn't work for me).
> 
> 
> 
> -----Original Message-----
> From: development-bounces at drupal.org 
> [mailto:development-bounces at drupal.org]
> On Behalf Of Moshe Weitzman
> Sent: Wednesday, October 18, 2006 7:38 AM
> To: development at drupal.org
> Subject: Re: [development] hooks after hook_menu is called, but before 
> page rendered
> 
> _craig wrote:
>> I'm in the process of updating taxonomy_breadcrumb to work with 5.0 
>> and as part of the upgrade I'm making a few improvements to the 
>> module.  I want to have an opportunity to change the breadcrumb trail 
>> after hook_menu has been called, but before the page is rendered in 
>> the theme.  I'm not able to find any way to do this.  Any suggestions?
>>
>> It seems as if I need a hook added right at the end of
>> menu_execute_active_handler() in menu.inc, after call_user_func_array 
>> (but before returning).  Am I missing something?  How can I have a 
>> function in my module execute after any other hook_menu's have been
> executed?
> 
> one way to do that is to adjust the weight for your module. set it to 
> a high number to be last. see the system table for that. this is 
> usually set by the module author in .install file
> 

there is no such hook. perhaps you can tell more about what you are doing
and we can suggest an approach, or create a new hook.



More information about the development mailing list