Source for file menu.php
Documentation is available at menu.php
* @package Joomla.Administrator
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
* Tree based class to render the admin menu
* @package Joomla.Administrator
* CSS string to add to document head
* @param JMenuNode &$node The node to process
* @param boolean $setCurrent True to set as current working node
public function addChild(JMenuNode &$node, $setCurrent =
false)
* Method to get the parent
* Method to get the parent
* Method to add a separator node
* Method to render the menu
* @param string $id The id of the menu to be rendered
* @param string $class The class of the menu to be rendered
public function renderMenu($id =
'menu', $class =
'')
$id =
'id="' .
$id .
'"';
$class =
'class="' .
$class .
'"';
// Recurse through children if they exist
echo
"<ul " .
$id .
" " .
$class .
">\n";
foreach ($this->_current->getChildren() as $child)
// Add style to document head
* Method to render a given level of a menu
* @param integer $depth The level of the menu to be rendered
// Build the CSS class suffix
$class =
' class="dropdown"';
if ($this->_current->class ==
'separator')
$class =
' class="divider"';
$class =
' class="dropdown-submenu"';
if ($this->_current->class ==
'disabled')
$class =
' class="disabled"';
echo
"<li" .
$class .
">";
// Print a link if it exists
$linkClass[] =
'dropdown-toggle';
$dataToggle =
' data-toggle="dropdown"';
if (!$this->_current->getParent()->hasParent())
$dropdownCaret =
' <span class="caret"></span>';
if ($this->_current->link !=
null &&
$this->_current->getParent()->title !=
'ROOT')
$linkClass[] =
$iconClass;
// Implode out $linkClass for rendering
$linkClass =
' class="' .
implode(' ', $linkClass) .
'"';
echo
"<a" .
$linkClass .
" " .
$dataToggle .
" href=\"" .
$this->_current->link .
"\" target=\"" .
$this->_current->target .
"\" >"
.
$this->_current->title .
$dropdownCaret .
"</a>";
echo
"<a" .
$linkClass .
" " .
$dataToggle .
" href=\"" .
$this->_current->link .
"\">" .
$this->_current->title .
$dropdownCaret .
"</a>";
echo
"<a" .
$linkClass .
" " .
$dataToggle .
">" .
$this->_current->title .
$dropdownCaret .
"</a>";
// Recurse through children if they exist
echo
'<ul' .
$id .
' class="dropdown-menu menu-component">' .
"\n";
echo
'<ul class="dropdown-menu">' .
"\n";
foreach ($this->_current->getChildren() as $child)
* Method to get the CSS class name for an icon identifier or create one if
* a custom image path is passed as the identifier
* @param string $identifier Icon identification string
* @return string CSS class name
// Initialise the known classes array if it does not exist
* If we don't already know about the class... build it and mark it
* known so we don't have to build it again
if (!isset
($classes[$identifier]))
if (substr($identifier, 0, 6) ==
'class:')
// We were passed a class name
$class =
substr($identifier, 6);
$classes[$identifier] =
"menu-$class";
// Build the CSS class for the icon
$class =
preg_replace('#\.\.[^A-Za-z0-9\.\_\- ]#', '', $class);
$this->_css .=
"\n.menu-$class {\n" .
"\tbackground: url($identifier) no-repeat;\n" .
$classes[$identifier] =
"menu-$class";
return $classes[$identifier];
* A Node for JAdminCssMenu
* @package Joomla.Administrator
* Constructor for the class.
* @param string $title The title of the node
* @param string $link The node link
* @param string $class The CSS class for the node
* @param boolean $active True if node is active, false otherwise
* @param string $target The link target
* @param string $titleicon The title icon for the node
public function __construct($title, $link =
null, $class =
null, $active =
false, $target =
null, $titleicon =
null)
$this->title =
$titleicon ?
$title .
$titleicon :
$title;
if (!empty($link) &&
$link !==
'#')
$params =
$uri->getQuery(true);
foreach ($params as $value)
* If the child already has a parent, the link is unset
* @param JMenuNode &$child The child to be added
public function addChild(JMenuNode &$child)
$child->setParent($this);
* Set the parent of a this node
* If the node already has a parent, the link is unset
* @param JMenuNode &$parent The JMenuNode for parent to be set or null
public function setParent(JMenuNode &$parent =
null)
unset
($this->_parent->children[$hash]);
$parent->_children[$hash] =
& $this;
* Get the children of this node
* @return array The children
* Get the parent of this node
* @return mixed JMenuNode object with the parent or null for no parent
* Test if this node has children
* @return boolean True if there are children
* Test if this node has a parent
* @return boolean True if there is a parent
Documentation generated on Tue, 19 Nov 2013 15:07:53 +0100 by phpDocumentor 1.4.3