aboutsummaryrefslogtreecommitdiff
path: root/engine/lib/navigation.php
diff options
context:
space:
mode:
Diffstat (limited to 'engine/lib/navigation.php')
-rw-r--r--engine/lib/navigation.php29
1 files changed, 27 insertions, 2 deletions
diff --git a/engine/lib/navigation.php b/engine/lib/navigation.php
index 10b11acfe..86624cd7c 100644
--- a/engine/lib/navigation.php
+++ b/engine/lib/navigation.php
@@ -308,6 +308,32 @@ function elgg_site_menu_setup($hook, $type, $return, $params) {
$return['more'] = array_splice($return['default'], $max_display_items);
}
}
+
+ // check if we have anything selected
+ $selected = false;
+ foreach ($return as $section_name => $section) {
+ foreach ($section as $key => $item) {
+ if ($item->getSelected()) {
+ $selected = true;
+ break 2;
+ }
+ }
+ }
+
+ if (!$selected) {
+ // nothing selected, match name to context
+ foreach ($return as $section_name => $section) {
+ foreach ($section as $key => $item) {
+ // only highlight internal links
+ if (strpos($item->getHref(), elgg_get_site_url()) === 0) {
+ if ($item->getName() == elgg_get_context()) {
+ $return[$section_name][$key]->setSelected(true);
+ break 2;
+ }
+ }
+ }
+ }
+ }
return $return;
}
@@ -339,11 +365,10 @@ function elgg_river_menu_setup($hook, $type, $return, $params) {
if (elgg_is_admin_logged_in()) {
$options = array(
'name' => 'delete',
- 'href' => "action/river/delete?id=$item->id",
+ 'href' => elgg_add_action_tokens_to_url("action/river/delete?id=$item->id"),
'text' => elgg_view_icon('delete'),
'title' => elgg_echo('delete'),
'confirm' => elgg_echo('deleteconfirm'),
- 'is_action' => true,
'priority' => 200,
);
$return[] = ElggMenuItem::factory($options);