mirror of
https://github.com/processwire/processwire.git
synced 2025-08-17 20:11:46 +02:00
Fix issue processwire/processwire-issues#946
This commit is contained in:
@@ -502,10 +502,23 @@ class AdminThemeUikit extends AdminThemeFramework implements Module, Configurabl
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public function hookClearCaches(HookEvent $event) {
|
public function hookClearCaches(HookEvent $event) {
|
||||||
$page = $event->arguments(0);
|
|
||||||
if(is_null($page) || ($page instanceof Page && $page->template == 'admin')) {
|
/** @var Page|User|null $page */
|
||||||
$this->wire('session')->removeFor($this, 'prnav');
|
$page = $event->arguments(0);
|
||||||
$this->wire('session')->message("Cleared the admin theme navigation cache (primary nav)", Notice::debug);
|
/** @var array $changes */
|
||||||
|
$changes = $event->arguments(1);
|
||||||
|
/** @var User $user */
|
||||||
|
$user = $this->wire('user');
|
||||||
|
|
||||||
|
if($page !== null && !($page instanceof Page)) return;
|
||||||
|
if(!is_array($changes)) $changes = array();
|
||||||
|
|
||||||
|
if($page === null || $page->template == 'admin' || ($page->id === $user->id && in_array('language', $changes))) {
|
||||||
|
/** @var Session $session */
|
||||||
|
$session = $this->wire('session');
|
||||||
|
$session->removeFor($this, 'prnav');
|
||||||
|
$session->removeFor($this, 'sidenav');
|
||||||
|
$session->message("Cleared the admin theme navigation cache (primary nav)", Notice::debug);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user