[development] Modify environment before & after block is rendered

Olivier Jacquet ojacquet at jax.be
Wed Sep 9 07:13:18 UTC 2009


Hi,


When themename_preprocess_block() is called the content of the block is 
already rendered. I am looking for a way to modify the environment 
before the block is rendered and a way to restore the environment 
afterwards.

The specific use case is that I have two blocks, generated by views, one 
showing the terms from one taxonomy and the other the titles of the 
nodes belonging to that taxonomy.

When one navigates to a node the link to that node is active but I would 
like the link to the taxonomy to be active as well. An easy way to 
accomplish this would be to do a 
menu_set_active_item('taxonomy/term/tid') before the taxonomy block is 
rendered and reset it afterwards. Unfortunately this doesn't seem to be 
possible.

The only other way I can think of is to modify the block content via 
regular expressions in themename_preprocess_block().


Thank you for your time,
Olivier


More information about the development mailing list