diff options
Diffstat (limited to 'engine/classes/ElggMenuItem.php')
-rw-r--r-- | engine/classes/ElggMenuItem.php | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/engine/classes/ElggMenuItem.php b/engine/classes/ElggMenuItem.php index 61dbf539e..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"; + } } /** @@ -420,6 +429,17 @@ class ElggMenuItem { } /** + * 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 * * @return array |