Hook active trail path I' am trying to make a custom module to set an active trail path to a menu. I created a views page. The active trail must be to a node or taxonmy term. When I open the pages created by the view the active trail is not active.

I wrote the script here below but it doesn't work, can somebody please help???

function mymodule_views_default_views(&amp;$view, &amp;$display_id, &amp;$args){
  if( $view-&gt;name = 'productdetail';)
    {menu_tree_set_path('menu-categorie', 'node/39');
 }
}
I found the answer to my own question.

In the view I added a field with the taxonomy term ID / node ID which is although used for my menu and hide the output and do a rewrite of the output.
I pasted the following code in the text field for rewrite; field_categorie-tid is my reference term from the menu.

menu_tree_set_path('menu-categorie', 'taxonomy/term/[field_categorie-tid]');


Instead of taxonomy/term/[field_categorie-tid] you can also use node/[nid].

I added in the head section a global field with PHP and token, and put &lt;?php [field_categorie]?&gt;.

That's all; no hooks nor custom scripting in the template.