Block visible by specific active menu
Last modified: September 22, 2009 - 21:11
Here is a block visibility snippet for showing a block on pages that have a specific active menu.
I use this snippet to show my multiple menus' blocks only on node pages that have an associated menu entry.
In this example, the block will show up if a page has a menu entry in the "menu-my-menu" menu.
This snippet has been successfully tested in Drupal 6.14.
<?php
$match = FALSE;
// block is visible if the node has the following active menu
$menu = 'menu-my-menu';
if (menu_get_active_menu_name() == $menu){
$match = TRUE;
}
return $match;
?>