Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
project
drupal
Commits
b4552cd9
Commit
b4552cd9
authored
Dec 10, 2005
by
Dries Buytaert
Browse files
- Patch
#40512
by Richard: fixed coding style + performance improvements.
parent
99e27195
Changes
1
Hide whitespace changes
Inline
Side-by-side
includes/menu.inc
View file @
b4552cd9
...
...
@@ -780,7 +780,7 @@ function menu_primary_links($start_level = 1, $pid = 0) {
}
}
//
s
pecial case - provide link to admin/menu if primary links is empty.
//
S
pecial case - provide link to admin/menu if primary links is empty.
if
(
is_null
(
$links
)
&&
$start_level
==
1
&&
$pid
==
variable_get
(
'menu_primary_menu'
,
0
))
{
$links
[
'1-1'
]
=
l
(
t
(
'edit primary links'
),
'admin/menu'
);
}
...
...
@@ -875,12 +875,11 @@ function _menu_get_active_trail() {
*/
function
_menu_get_active_trail_in_submenu
(
$pid
)
{
static
$trails
;
static
$built
;
if
(
!
$built
)
{
if
(
!
isset
(
$trails
)
)
{
// Find all menu items which point to the current node and for each
// follow the parents up the chain to build an active trail.
$
bu
il
t
=
TRUE
;
$
tra
il
s
=
array
()
;
$menu
=
menu_get_menu
();
$path
=
$_GET
[
'q'
];
$count
=
0
;
...
...
@@ -893,7 +892,7 @@ function _menu_get_active_trail_in_submenu($pid) {
array_unshift
(
$trails
[
$count
],
$mid
);
$mid
=
$menu
[
'items'
][
$mid
][
'pid'
];
}
$count
++
;
$count
++
;
}
}
$path
=
substr
(
$path
,
0
,
strrpos
(
$path
,
'/'
));
...
...
@@ -901,13 +900,14 @@ function _menu_get_active_trail_in_submenu($pid) {
}
if
(
$trails
)
{
foreach
(
$trails
as
$key
=>
$trail
)
{
for
(
$i
=
0
;
$i
<
count
(
$trail
);
$i
++
)
{
foreach
(
$trails
as
$trail
)
{
$count_trail
=
count
(
$trail
);
for
(
$i
=
0
;
$i
<
$count_trail
;
$i
++
)
{
if
(
$trail
[
$i
]
==
$pid
)
{
//
create
a trail from $pid to the current page inclusive.
for
(
;
$i
<
count
(
$
trail
)
;
$i
++
)
{
$subtrail
[]
=
$trail
[
$i
];
}
//
Return
a trail from $pid
down
to the current page inclusive.
for
(
;
$i
<
$
count
_
trail
;
$i
++
)
{
$subtrail
[]
=
$trail
[
$i
];
}
return
$subtrail
;
}
}
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment