mirror of
https://github.com/processwire/processwire.git
synced 2025-08-20 21:42:23 +02:00
Fix issue processwire/processwire-issues#845
This commit is contained in:
@@ -120,7 +120,9 @@ class AdminThemeUikit extends AdminThemeFramework implements Module, Configurabl
|
|||||||
|
|
||||||
// disable sidebar layout if SystemNotifications is active
|
// disable sidebar layout if SystemNotifications is active
|
||||||
if($sidenav && $modules->isInstalled('SystemNotifications')) {
|
if($sidenav && $modules->isInstalled('SystemNotifications')) {
|
||||||
if(!$modules->get('SystemNotifications')->disabled) {
|
/** @var SystemNotifications $systemNotifications */
|
||||||
|
$systemNotifications = $modules->get('SystemNotifications');
|
||||||
|
if(!$systemNotifications->disabled) {
|
||||||
$this->layout = '';
|
$this->layout = '';
|
||||||
$sidenav = false;
|
$sidenav = false;
|
||||||
}
|
}
|
||||||
@@ -726,22 +728,38 @@ class AdminThemeUikit extends AdminThemeFramework implements Module, Configurabl
|
|||||||
* Render sidebar navigation that uses uk-nav
|
* Render sidebar navigation that uses uk-nav
|
||||||
*
|
*
|
||||||
* The contents is the same as the Primary nav, except that output is prepared for sidebar.
|
* The contents is the same as the Primary nav, except that output is prepared for sidebar.
|
||||||
|
* This method uses a session-cached version. To clear the cache, logout then log back in.
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public function renderSidebarNavItems() {
|
public function renderSidebarNavItems() {
|
||||||
|
|
||||||
$cache = self::dev ? '' : $this->wire('session')->getFor($this, 'sidenav');
|
// see if we can get it from the cache
|
||||||
|
$out = self::dev ? '' : $this->wire('session')->getFor($this, 'sidenav');
|
||||||
|
|
||||||
if($cache) {
|
if(empty($out)) {
|
||||||
$this->markCurrentNavItems($cache);
|
$out = $this->renderSidebarNavCache();
|
||||||
return $cache;
|
$this->wire('session')->setFor($this, 'sidenav', $out);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$out = str_replace('<!--pw-user-nav-label-->', $this->renderUserNavLabel(), $out);
|
||||||
|
$this->markCurrentNavItems($out);
|
||||||
|
|
||||||
|
return $out;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Re-renders the sidebar nav to be cached
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
protected function renderSidebarNavCache() {
|
||||||
|
|
||||||
$out = '';
|
$out = '';
|
||||||
$items = $this->getPrimaryNavArray();
|
$items = $this->getPrimaryNavArray();
|
||||||
$ukNav = "class='uk-nav-sub uk-nav-default uk-nav-parent-icon' data-uk-nav='animation: false; multiple: true;'";
|
$ulAttrs = "class='uk-nav-sub uk-nav-default uk-nav-parent-icon' data-uk-nav='animation: false; multiple: true;'";
|
||||||
|
|
||||||
foreach($items as $item) {
|
foreach($items as $item) {
|
||||||
|
|
||||||
@@ -758,14 +776,14 @@ class AdminThemeUikit extends AdminThemeFramework implements Module, Configurabl
|
|||||||
$childNavList = $this->renderPrimaryNavItemChildren($child['children']);
|
$childNavList = $this->renderPrimaryNavItemChildren($child['children']);
|
||||||
$childIcon = $this->renderNavIcon('arrow-circle-right');
|
$childIcon = $this->renderNavIcon('arrow-circle-right');
|
||||||
$childNav =
|
$childNav =
|
||||||
"<ul $ukNav>" .
|
"<ul $ulAttrs>" .
|
||||||
"<li class='pw-nav-dup'><a href='$child[url]'>$childIcon$child[title]</a></li>" .
|
"<li class='pw-nav-dup'><a href='$child[url]'>$childIcon$child[title]</a></li>" .
|
||||||
$childNavList .
|
$childNavList .
|
||||||
"</ul>";
|
"</ul>";
|
||||||
} else if($child['navJSON']) {
|
} else if($child['navJSON']) {
|
||||||
$childClass .= ' uk-parent';
|
$childClass .= ' uk-parent';
|
||||||
$childAttr = " class='pw-has-items pw-has-ajax-items' data-json='$child[navJSON]'";
|
$childAttr = " class='pw-has-items pw-has-ajax-items' data-json='$child[navJSON]'";
|
||||||
$childNav = "<ul $ukNav></ul>";
|
$childNav = "<ul $ulAttrs></ul>";
|
||||||
}
|
}
|
||||||
$subnav .= "<li class='$childClass'><a$childAttr href='$child[url]'>$icon$child[title]</a>";
|
$subnav .= "<li class='$childClass'><a$childAttr href='$child[url]'>$icon$child[title]</a>";
|
||||||
$subnav .= $childNav . "</li>";
|
$subnav .= $childNav . "</li>";
|
||||||
@@ -775,7 +793,7 @@ class AdminThemeUikit extends AdminThemeFramework implements Module, Configurabl
|
|||||||
$icon = $this->renderNavIcon($item['icon']);
|
$icon = $this->renderNavIcon($item['icon']);
|
||||||
$class .= " uk-parent";
|
$class .= " uk-parent";
|
||||||
$subnav =
|
$subnav =
|
||||||
"<ul $ukNav>" .
|
"<ul $ulAttrs>" .
|
||||||
"<li class='pw-nav-dup'><a href='$item[url]'>$icon$item[title]</a></li>" .
|
"<li class='pw-nav-dup'><a href='$item[url]'>$icon$item[title]</a></li>" .
|
||||||
$subnav .
|
$subnav .
|
||||||
"</ul>";
|
"</ul>";
|
||||||
@@ -788,16 +806,12 @@ class AdminThemeUikit extends AdminThemeFramework implements Module, Configurabl
|
|||||||
}
|
}
|
||||||
|
|
||||||
// render user nav
|
// render user nav
|
||||||
$userNav = $this->renderUserNavItems();
|
|
||||||
$out .=
|
$out .=
|
||||||
"<li class='uk-parent'>" .
|
"<li class='uk-parent'>" .
|
||||||
"<a href='#'>" . $this->renderUserNavLabel() . "</a>" .
|
"<a href='#'><!--pw-user-nav-label--></a>" .
|
||||||
"<ul $ukNav>$userNav</ul>" .
|
"<ul $ulAttrs>" . $this->renderUserNavItems() . "</ul>" .
|
||||||
"</li>";
|
"</li>";
|
||||||
|
|
||||||
$this->wire('session')->setFor($this, 'sidenav', $out);
|
|
||||||
$this->markCurrentNavItems($out);
|
|
||||||
|
|
||||||
return $out;
|
return $out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user