Change record status: 
Project: 
Introduced in branch: 
7.x
Introduced in version: 
7.12
Description: 
  • The $parameters argument of menu_build_tree() has a new key: $conditions.
  • $conditions is an associative array of custom database select query condition key/value pairs.

What does this change for developpers?

Well, let's understand it by an example:

  • before the change, if you want to retrieve the menu link tree of "Add content" (including "Add content" itself) for Administration menu using menu_build_tree(), you would try something like:
        $node_add = db_query("SELECT * FROM {menu_links} WHERE router_path = 'node/add' AND module = 'system'")->fetch();
        $tree = menu_build_tree($node_add->menu_name, array(
          'expanded' => array($node_add->plid, $node_add->mlid),
          'min_depth' => $node_add->depth,
        ));

    but this retrieves the entire Navigation menu! You don't really need this!

  • After the change, you can specify conditions to be used in the query defined in _menu_build_tree. You can then try write something like :
        $node_add = db_query("SELECT * FROM {menu_links} WHERE router_path = 'node/add' AND module = 'system'")->fetch();
        $tree = menu_build_tree($node_add->menu_name, array(
          'conditions' => array('p1' => $node_add->mlid),
          'min_depth' => $node_add->depth,
        ));
    
Impacts: 
Module developers
Updates Done (doc team, etc.)
Online documentation: 
Not done
Theming guide: 
Not done
Module developer documentation: 
Not done
Examples project: 
Not done
Coder Review: 
Not done
Coder Upgrade: 
Not done
Other: 
Other updates done