diff options
author | webchick <webchick@24967.no-reply.drupal.org> | 2011-12-24 18:04:56 -0800 |
---|---|---|
committer | webchick <webchick@24967.no-reply.drupal.org> | 2011-12-24 18:04:56 -0800 |
commit | aa8e8f4de83ca990a56e97ea317cee2bfc657a12 (patch) | |
tree | 40f4e0646699b3352bcdeb40eddb481906ce92d1 /includes/menu.inc | |
parent | 9f742a2cb8a2f5193337c9a48ac274d0beaa047f (diff) | |
download | brdo-aa8e8f4de83ca990a56e97ea317cee2bfc657a12.tar.gz brdo-aa8e8f4de83ca990a56e97ea317cee2bfc657a12.tar.bz2 |
Issue #1025582 by sun: Added Custom db_select() 'conditions' parameter for menu_build_tree().
Diffstat (limited to 'includes/menu.inc')
-rw-r--r-- | includes/menu.inc | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/includes/menu.inc b/includes/menu.inc index bdbbbb62c..25a87af12 100644 --- a/includes/menu.inc +++ b/includes/menu.inc @@ -1339,6 +1339,8 @@ function menu_tree_page_data($menu_name, $max_depth = NULL, $only_active_trail = * Defaults to 1, which is the default to build a whole tree for a menu, i.e. * excluding menu container itself. * - max_depth: The maximum depth of menu links in the resulting tree. + * - conditions: An associative array of custom database select query + * condition key/value pairs; see _menu_build_tree() for the actual query. * * @return * A fully built menu tree. @@ -1422,6 +1424,12 @@ function _menu_build_tree($menu_name, array $parameters = array()) { if (isset($parameters['max_depth'])) { $query->condition('ml.depth', $parameters['max_depth'], '<='); } + // Add custom query conditions, if any were passed. + if (isset($parameters['conditions'])) { + foreach ($parameters['conditions'] as $column => $value) { + $query->condition($column, $value); + } + } // Build an ordered array of links using the query result object. $links = array(); |