From 43ecf89d0410c2a3f7c07db58722c856deec7cbf Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Thu, 5 Sep 2019 15:59:59 +0200 Subject: [PATCH] wip #3005 @0:20 --- src/app/Magic/Menu/Menu.php | 10 ++++++---- src/app/Magic/Menu/PageItem.php | 6 ++++-- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/app/Magic/Menu/Menu.php b/src/app/Magic/Menu/Menu.php index 417375d..1c707e4 100644 --- a/src/app/Magic/Menu/Menu.php +++ b/src/app/Magic/Menu/Menu.php @@ -70,9 +70,11 @@ class Menu extends BaseMenu // Skip redirection & navigation pages if ($page instanceof PageItem) { /** @var PageItem $template */ - $template = $page->getPage()->getUsedTemplate(); - if ($template instanceof Redirection || $template instanceof Navigation) { - continue; + if (null !== $page->getPage()) { + $template = $page->getPage()->getUsedTemplate(); + if ($template instanceof Redirection || $template instanceof Navigation) { + continue; + } } } @@ -166,7 +168,7 @@ class Menu extends BaseMenu if ($child->isNavigable()) { $parent = $menu->add($child->getTitle(), $child->getHref()); } else { - $parent = $menu->raw(''.$child->getTitle().''); + $parent = $menu->raw('' . $child->getTitle() . ''); } $this->makeMobileMenu($parent, $child, $depth - 1); } diff --git a/src/app/Magic/Menu/PageItem.php b/src/app/Magic/Menu/PageItem.php index dcebaa9..9ec85c7 100644 --- a/src/app/Magic/Menu/PageItem.php +++ b/src/app/Magic/Menu/PageItem.php @@ -57,7 +57,9 @@ class PageItem extends Item { if ($this->getPage() instanceof CMSPage) { $template = $this->getPage()->getUsedTemplate(); - $template->setMenuChildren($this); + if(null!==$template) { + $template->setMenuChildren($this); + } } } @@ -110,7 +112,7 @@ class PageItem extends Item public function isVirtual() { if (null === $this->_isVirtual) { - if ($this->getPage() instanceof CMSPage) { + if ($this->getPage() instanceof CMSPage && null!==$this->getPage()->getUsedTemplate()) { $this->_isVirtual = $this->getPage()->getUsedTemplate()->isVirtual(); } else { $this->_isVirtual = false; -- 2.39.5