Navigation/DashboardPane: Properly register dashlets as children

refs #3542
This commit is contained in:
Johannes Meyer 2019-06-26 15:48:55 +02:00
parent 37a972cf75
commit 4fdfb190ad
3 changed files with 8 additions and 18 deletions

View File

@ -314,9 +314,12 @@ class Module
$navigation = new Navigation();
foreach ($panes as $pane) {
/** @var DashboardContainer $pane */
$dashlets = array();
$dashlets = [];
foreach ($pane->getDashlets() as $dashletName => $dashletUrl) {
$dashlets[$this->translate($dashletName)] = $dashletUrl;
$dashlets[$dashletName] = [
'label' => $this->translate($dashletName),
'url' => $dashletUrl
];
}
$navigation->addItem(
@ -326,7 +329,7 @@ class Module
array(
'label' => $this->translate($pane->getName()),
'type' => 'dashboard-pane',
'dashlets' => $dashlets
'children' => $dashlets
)
)
);

View File

@ -62,19 +62,6 @@ class DashboardPane extends NavigationItem
$this->setUrl(Url::fromPath('dashboard', array('pane' => $this->getName())));
}
/**
* {@inheritdoc}
*/
public function merge(NavigationItem $item)
{
parent::merge($item);
$this->setDashlets(array_merge(
$this->getDashlets(false),
$item->getDashlets(false)
));
}
/**
* Set disabled state for pane
*

View File

@ -77,8 +77,8 @@ class Dashboard extends AbstractWidget
foreach ($navigation as $dashboardPane) {
/** @var DashboardPane $dashboardPane */
$pane = new Pane($dashboardPane->getLabel());
foreach ($dashboardPane->getDashlets(false) as $title => $url) {
$pane->addDashlet($title, $url);
foreach ($dashboardPane->getChildren() as $dashlet) {
$pane->addDashlet($dashlet->getLabel(), $dashlet->getUrl());
}
$panes[] = $pane;