- Patch #40512 by Richard: fixed coding style + performance improvements.
parent
99e27195e8
commit
b4552cd977
|
@ -780,7 +780,7 @@ function menu_primary_links($start_level = 1, $pid = 0) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// special case - provide link to admin/menu if primary links is empty.
|
// Special 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)) {
|
if (is_null($links) && $start_level == 1 && $pid == variable_get('menu_primary_menu', 0)) {
|
||||||
$links['1-1'] = l(t('edit primary links'),'admin/menu');
|
$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) {
|
function _menu_get_active_trail_in_submenu($pid) {
|
||||||
static $trails;
|
static $trails;
|
||||||
static $built;
|
|
||||||
|
|
||||||
if (!$built) {
|
if (!isset($trails)) {
|
||||||
// Find all menu items which point to the current node and for each
|
// Find all menu items which point to the current node and for each
|
||||||
// follow the parents up the chain to build an active trail.
|
// follow the parents up the chain to build an active trail.
|
||||||
$built = TRUE;
|
$trails = array();
|
||||||
$menu = menu_get_menu();
|
$menu = menu_get_menu();
|
||||||
$path = $_GET['q'];
|
$path = $_GET['q'];
|
||||||
$count = 0;
|
$count = 0;
|
||||||
|
@ -901,11 +900,12 @@ function _menu_get_active_trail_in_submenu($pid) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($trails) {
|
if ($trails) {
|
||||||
foreach ($trails as $key => $trail) {
|
foreach ($trails as $trail) {
|
||||||
for ($i = 0 ; $i < count($trail); $i++) {
|
$count_trail = count($trail);
|
||||||
|
for ($i = 0; $i < $count_trail; $i++) {
|
||||||
if ($trail[$i] == $pid) {
|
if ($trail[$i] == $pid) {
|
||||||
// create a trail from $pid to the current page inclusive.
|
// Return a trail from $pid down to the current page inclusive.
|
||||||
for ( ; $i < count($trail) ; $i++) {
|
for ( ; $i < $count_trail; $i++) {
|
||||||
$subtrail[] = $trail[$i];
|
$subtrail[] = $trail[$i];
|
||||||
}
|
}
|
||||||
return $subtrail;
|
return $subtrail;
|
||||||
|
|
Loading…
Reference in New Issue