Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
drupal-3443915
Manage
Activity
Members
Labels
Plan
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Issue forks
drupal-3443915
Commits
3b3798f2
Commit
3b3798f2
authored
13 years ago
by
catch
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#1025582
by sun: Added Custom db_select() 'conditions' parameter for menu_build_tree().
parent
f7dd1a5f
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
core/includes/menu.inc
+8
-0
8 additions, 0 deletions
core/includes/menu.inc
with
8 additions
and
0 deletions
core/includes/menu.inc
+
8
−
0
View file @
3b3798f2
...
...
@@ -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
();
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment