mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-23 05:44:36 +02:00
parent
a408636923
commit
ed6da19876
@ -36,6 +36,13 @@ class NavigationItem implements IteratorAggregate
|
|||||||
*/
|
*/
|
||||||
protected $active;
|
protected $active;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The CSS class used for the outer li element
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $cssClass;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This item's priority
|
* This item's priority
|
||||||
*
|
*
|
||||||
@ -200,6 +207,29 @@ class NavigationItem implements IteratorAggregate
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the CSS class used for the outer li element
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getCssClass()
|
||||||
|
{
|
||||||
|
return $this->cssClass;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the CSS class to use for the outer li element
|
||||||
|
*
|
||||||
|
* @param string $class
|
||||||
|
*
|
||||||
|
* @return $this
|
||||||
|
*/
|
||||||
|
public function setCssClass($class)
|
||||||
|
{
|
||||||
|
$this->cssClass = (string) $class;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return this item's priority
|
* Return this item's priority
|
||||||
*
|
*
|
||||||
|
@ -304,10 +304,10 @@ class NavigationRenderer implements RecursiveIterator, NavigationRendererInterfa
|
|||||||
*/
|
*/
|
||||||
public function beginItemMarkup(NavigationItem $item)
|
public function beginItemMarkup(NavigationItem $item)
|
||||||
{
|
{
|
||||||
$cssClass = array(static::CSS_CLASS_ITEM);
|
$cssClasses = array(static::CSS_CLASS_ITEM);
|
||||||
|
|
||||||
if ($item->hasChildren() && $item->getChildren()->getLayout() === Navigation::LAYOUT_DROPDOWN) {
|
if ($item->hasChildren() && $item->getChildren()->getLayout() === Navigation::LAYOUT_DROPDOWN) {
|
||||||
$cssClass[] = static::CSS_CLASS_DROPDOWN;
|
$cssClasses[] = static::CSS_CLASS_DROPDOWN;
|
||||||
$item
|
$item
|
||||||
->setAttribute('class', static::CSS_CLASS_DROPDOWN_TOGGLE)
|
->setAttribute('class', static::CSS_CLASS_DROPDOWN_TOGGLE)
|
||||||
->setIcon(static::DROPDOWN_TOGGLE_ICON)
|
->setIcon(static::DROPDOWN_TOGGLE_ICON)
|
||||||
@ -315,12 +315,16 @@ class NavigationRenderer implements RecursiveIterator, NavigationRendererInterfa
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($item->getActive()) {
|
if ($item->getActive()) {
|
||||||
$cssClass[] = static::CSS_CLASS_ACTIVE;
|
$cssClasses[] = static::CSS_CLASS_ACTIVE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($cssClass = $item->getCssClass()) {
|
||||||
|
$cssClasses[] = $cssClass;
|
||||||
}
|
}
|
||||||
|
|
||||||
$content = sprintf(
|
$content = sprintf(
|
||||||
'<li class="%s">',
|
'<li class="%s">',
|
||||||
join(' ', $cssClass)
|
join(' ', $cssClasses)
|
||||||
);
|
);
|
||||||
return $content;
|
return $content;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user