Add nav-level-$level CSS classes to navigation

This commit is contained in:
Eric Lippmann 2015-10-27 13:52:18 +01:00
parent dc273aa9a1
commit 4eb92438dd
2 changed files with 6 additions and 2 deletions

View File

@ -271,9 +271,11 @@ class NavigationRenderer implements RecursiveIterator, NavigationRendererInterfa
/** /**
* Return the opening markup for multiple navigation items * Return the opening markup for multiple navigation items
* *
* @param int $level
*
* @return string * @return string
*/ */
public function beginChildrenMarkup() public function beginChildrenMarkup($level = 1)
{ {
$cssClass = array(static::CSS_CLASS_NAV); $cssClass = array(static::CSS_CLASS_NAV);
if ($this->navigation->getLayout() === Navigation::LAYOUT_TABS) { if ($this->navigation->getLayout() === Navigation::LAYOUT_TABS) {
@ -282,6 +284,8 @@ class NavigationRenderer implements RecursiveIterator, NavigationRendererInterfa
$cssClass[] = static::CSS_CLASS_NAV_DROPDOWN; $cssClass[] = static::CSS_CLASS_NAV_DROPDOWN;
} }
$cssClass[] = 'nav-level-' . $level;
return '<ul class="' . join(' ', $cssClass) . '">'; return '<ul class="' . join(' ', $cssClass) . '">';
} }

View File

@ -142,7 +142,7 @@ class RecursiveNavigationRenderer extends RecursiveIteratorIterator implements N
*/ */
public function beginChildren() public function beginChildren()
{ {
$this->content[] = $this->getInnerIterator()->beginChildrenMarkup(); $this->content[] = $this->getInnerIterator()->beginChildrenMarkup($this->getDepth() + 1);
} }
/** /**