Merge branch 'master' into feature/dope-layout-5543
This commit is contained in:
commit
56ed92a8e6
|
@ -25,7 +25,7 @@ if (! $this->auth()->isAuthenticated()) {
|
||||||
'layout/menu.phtml',
|
'layout/menu.phtml',
|
||||||
'default',
|
'default',
|
||||||
array(
|
array(
|
||||||
'menuRenderer' => Icinga::app()->getMenu()->getRenderer()
|
'menuRenderer' => Icinga::app()->getMenu()->getRenderer()->setUseStandardItemRenderer()
|
||||||
)
|
)
|
||||||
) ?>
|
) ?>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -44,7 +44,9 @@ class DashboardPane extends NavigationItem
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($ordered) {
|
if ($ordered) {
|
||||||
ksort($this->dashlets);
|
$dashlets = $this->dashlets;
|
||||||
|
ksort($dashlets);
|
||||||
|
return $dashlets;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->dashlets;
|
return $this->dashlets;
|
||||||
|
|
|
@ -8,6 +8,7 @@ use RecursiveIteratorIterator;
|
||||||
use Icinga\Exception\IcingaException;
|
use Icinga\Exception\IcingaException;
|
||||||
use Icinga\Web\Navigation\Navigation;
|
use Icinga\Web\Navigation\Navigation;
|
||||||
use Icinga\Web\Navigation\NavigationItem;
|
use Icinga\Web\Navigation\NavigationItem;
|
||||||
|
use Icinga\Web\Navigation\Renderer\NavigationItemRenderer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Renderer for multi level navigation
|
* Renderer for multi level navigation
|
||||||
|
@ -25,6 +26,13 @@ class RecursiveNavigationRenderer extends RecursiveIteratorIterator implements N
|
||||||
*/
|
*/
|
||||||
protected $content;
|
protected $content;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether to use the standard item renderer
|
||||||
|
*
|
||||||
|
* @var bool
|
||||||
|
*/
|
||||||
|
protected $useStandardRenderer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new RecursiveNavigationRenderer
|
* Create a new RecursiveNavigationRenderer
|
||||||
*
|
*
|
||||||
|
@ -39,6 +47,29 @@ class RecursiveNavigationRenderer extends RecursiveIteratorIterator implements N
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set whether to use the standard navigation item renderer
|
||||||
|
*
|
||||||
|
* @param bool $state
|
||||||
|
*
|
||||||
|
* @return $this
|
||||||
|
*/
|
||||||
|
public function setUseStandardItemRenderer($state = true)
|
||||||
|
{
|
||||||
|
$this->useStandardRenderer = (bool) $state;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return whether to use the standard navigation item renderer
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function getUseStandardItemRenderer()
|
||||||
|
{
|
||||||
|
return $this->useStandardRenderer;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
|
@ -132,7 +163,14 @@ class RecursiveNavigationRenderer extends RecursiveIteratorIterator implements N
|
||||||
/** @var NavigationItem $item */
|
/** @var NavigationItem $item */
|
||||||
if ($item->shouldRender()) {
|
if ($item->shouldRender()) {
|
||||||
$this->content[] = $this->getInnerIterator()->beginItemMarkup($item);
|
$this->content[] = $this->getInnerIterator()->beginItemMarkup($item);
|
||||||
$this->content[] = $item->render();
|
|
||||||
|
if ($this->getUseStandardItemRenderer()) {
|
||||||
|
$renderer = new NavigationItemRenderer();
|
||||||
|
$this->content[] = $renderer->render($item);
|
||||||
|
} else {
|
||||||
|
$this->content[] = $item->render();
|
||||||
|
}
|
||||||
|
|
||||||
if (! $item->hasChildren()) {
|
if (! $item->hasChildren()) {
|
||||||
$this->content[] = $this->getInnerIterator()->endItemMarkup();
|
$this->content[] = $this->getInnerIterator()->endItemMarkup();
|
||||||
}
|
}
|
||||||
|
|
|
@ -77,7 +77,7 @@ class Dashboard extends AbstractWidget
|
||||||
foreach ($navigation as $dashboardPane) {
|
foreach ($navigation as $dashboardPane) {
|
||||||
/** @var DashboardPane $dashboardPane */
|
/** @var DashboardPane $dashboardPane */
|
||||||
$pane = new Pane($dashboardPane->getLabel());
|
$pane = new Pane($dashboardPane->getLabel());
|
||||||
foreach ($dashboardPane->getDashlets() as $title => $url) {
|
foreach ($dashboardPane->getDashlets(false) as $title => $url) {
|
||||||
$pane->addDashlet($title, $url);
|
$pane->addDashlet($title, $url);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue