Skip to content

Instantly share code, notes, and snippets.

@phenix-factory
Last active December 15, 2015 03:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save phenix-factory/5195307 to your computer and use it in GitHub Desktop.
Save phenix-factory/5195307 to your computer and use it in GitHub Desktop.
Drupal: aller chercher le sous menu de la node en cour.
<?php
/*Ne pas oublier d'aller chercher le bon chemin de node !*/
$path = 'node/'.$node->nid;
$parent = menu_link_get_preferred($path);
$parameters = array(
'active_trail' => array($parent['plid']),
'only_active_trail' => FALSE,
'min_depth' => $parent['depth']+1,
'max_depth' => $parent['depth']+1,
'conditions' => array('plid' => $parent['mlid']),
);
$children = menu_build_tree($parent['menu_name'], $parameters);
/* menu_tree_output permet de rendre le tableau "renderable" */
print render(menu_tree_output($children));
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment