|
|
@@ -314,32 +314,33 @@ class Zend_View_Helper_Navigation_Menu
|
|
|
$minDepth,
|
|
|
$maxDepth)
|
|
|
{
|
|
|
- if (!$found = $this->findActive($container, $minDepth, $maxDepth)) {
|
|
|
+ if (!$active = $this->findActive($container, $minDepth - 1, $maxDepth)) {
|
|
|
return '';
|
|
|
}
|
|
|
|
|
|
- $foundPage = $found['page'];
|
|
|
- $foundDepth = $found['depth'];
|
|
|
-
|
|
|
- // render children or siblings?
|
|
|
- if (!$foundPage->hasPages()) {
|
|
|
+ // special case if active page is one below minDepth
|
|
|
+ if ($active['depth'] < $minDepth) {
|
|
|
+ if (!$active['page']->hasPages()) {
|
|
|
+ return '';
|
|
|
+ }
|
|
|
+ } else if (!$active['page']->hasPages()) {
|
|
|
// found pages has no children; render siblings
|
|
|
- $foundPage = $foundPage->getParent();
|
|
|
- } else if (is_int($maxDepth) && $foundDepth +1 > $maxDepth) {
|
|
|
+ $active['page'] = $active['page']->getParent();
|
|
|
+ } else if (is_int($maxDepth) && $active['depth'] +1 > $maxDepth) {
|
|
|
// children are below max depth; render siblings
|
|
|
- $foundPage = $foundPage->getParent();
|
|
|
+ $active['page'] = $active['page']->getParent();
|
|
|
}
|
|
|
|
|
|
$ulClass = $ulClass ? ' class="' . $ulClass . '"' : '';
|
|
|
$html = $indent . '<ul' . $ulClass . '>' . self::EOL;
|
|
|
|
|
|
- foreach ($foundPage as $page) {
|
|
|
- if (!$this->accept($page)) {
|
|
|
+ foreach ($active['page'] as $subPage) {
|
|
|
+ if (!$this->accept($subPage)) {
|
|
|
continue;
|
|
|
}
|
|
|
- $liClass = $page->isActive(true) ? ' class="active"' : '';
|
|
|
+ $liClass = $subPage->isActive(true) ? ' class="active"' : '';
|
|
|
$html .= $indent . ' <li' . $liClass . '>' . self::EOL;
|
|
|
- $html .= $indent . ' ' . $this->htmlify($page) . self::EOL;
|
|
|
+ $html .= $indent . ' ' . $this->htmlify($subPage) . self::EOL;
|
|
|
$html .= $indent . ' </li>' . self::EOL;
|
|
|
}
|
|
|
|