Modify environment before & after block is rendered
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
have you tried taxonomy menu module? On Wed, Sep 9, 2009 at 3:13 PM, Olivier Jacquet <ojacquet@jax.be> wrote:
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
-- Daniel Honrade, Jr. mobile: +63 915 903 3561 alternate email: danielhonrade@gmail.com websites: http://danielhonrade.com http://webtheming.com When you signup for PayPal, you can start accepting credit card payments instantly. As the world's number one online payment service, PayPal is the fastest way to open your doors to over 150 million member accounts worldwide. Best of all, it's completely free to sign up! To sign up or learn more, click here: https://www.paypal.com/ph/mrb/pal=GE47NYP4D94XA
Yes, it doesn't do this at all. Other modules set the active item to the taxonomy path which activates the link to the taxonomy page but then the link to the node is no longer active. I want to activate two different links in two different blocks on one page. Daniel Honrade wrote:
have you tried taxonomy menu module?
On Wed, Sep 9, 2009 at 3:13 PM, Olivier Jacquet <ojacquet@jax.be> wrote:
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
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.
To edit view content, use hook_views_pre_render
participants (3)
-
Daniel Honrade -
Fred Jones -
Olivier Jacquet