Community Documentation

menu trail and has children

Last updated January 27, 2008. Created by DynV on December 19, 2007.
Log in to edit this page.

Displays only if in a menu trail and has children.

This code has been taken from links from menu which has been tested on Drupal 5.5

<?php
$context_menu
= FALSE;

// Retrieves the current menu item
$menu_ctx=menu_get_item(menu_get_active_nontask_item());

// Does the current menu have children
if (count($menu_ctx['children'])-4 > 0) // has 4 items not in the menu
{
 
$context_menu = TRUE;
}

return
$context_menu;
?>

PS: count($menu_ctx['children'])-4 > 0 may need to be fixed, message me (not reply) to make me hurry

Reference

Drupal’s online documentation is © 2000-2012 by the individual contributors and can be used in accordance with the Creative Commons License, Attribution-ShareAlike 2.0. PHP code is distributed under the GNU General Public License.