From a3a84cec2f5424a9195c38f299161278a623913a Mon Sep 17 00:00:00 2001 From: cash Date: Sat, 11 Jun 2011 14:01:13 +0000 Subject: sorting plugin settings menu items by text git-svn-id: http://code.elgg.org/elgg/trunk@9169 36083f99-b078-4883-b0ff-0f9b5a30f544 --- engine/classes/ElggMenuItem.php | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'engine/classes/ElggMenuItem.php') diff --git a/engine/classes/ElggMenuItem.php b/engine/classes/ElggMenuItem.php index 61dbf539e..caaba49a1 100644 --- a/engine/classes/ElggMenuItem.php +++ b/engine/classes/ElggMenuItem.php @@ -419,6 +419,17 @@ class ElggMenuItem { $this->children[] = $item; } + /** + * Set the menu item's children + * + * @param array $children Array of ElggMenuItems + * + * @return void + */ + public function setChildren($children) { + $this->children = $children; + } + /** * Get the children menu items * -- cgit v1.2.3 From a420910a8b782bae53fbd7f86102db9f9b831388 Mon Sep 17 00:00:00 2001 From: cash Date: Mon, 13 Jun 2011 01:46:50 +0000 Subject: Fixes #3282 always using a menu item's name in its class git-svn-id: http://code.elgg.org/elgg/trunk@9200 36083f99-b078-4883-b0ff-0f9b5a30f544 --- engine/classes/ElggMenuItem.php | 11 ++++++++++- views/default/navigation/menu/elements/item.php | 8 +------- 2 files changed, 11 insertions(+), 8 deletions(-) (limited to 'engine/classes/ElggMenuItem.php') diff --git a/engine/classes/ElggMenuItem.php b/engine/classes/ElggMenuItem.php index caaba49a1..157ed9ceb 100644 --- a/engine/classes/ElggMenuItem.php +++ b/engine/classes/ElggMenuItem.php @@ -325,7 +325,16 @@ class ElggMenuItem { * @return string */ public function getItemClass() { - return implode(' ', $this->itemClass); + //allow people to specify name with underscores and colons + $name = str_replace('_', '-', $this->getName()); + $name = str_replace(':', '-', $name); + + $class = implode(' ', $this->itemClass); + if ($class) { + return "elgg-menu-item-$name $class"; + } else { + return "elgg-menu-item-$name"; + } } /** diff --git a/views/default/navigation/menu/elements/item.php b/views/default/navigation/menu/elements/item.php index 55ddc2fe4..f3e46315b 100644 --- a/views/default/navigation/menu/elements/item.php +++ b/views/default/navigation/menu/elements/item.php @@ -22,13 +22,7 @@ if ($children) { $item_class = $item->getItemClass(); -//allow people to specify name with underscores -$name = str_replace('_', '-', $item->getName()); -if ($item_class) { - $class = "class=\"elgg-menu-item-$name $item_class\""; -} - -echo "
  • "; +echo "
  • "; echo $item->getContent(); if ($children) { echo elgg_view('navigation/menu/elements/section', array( -- cgit v1.2.3