From: Vincent Vanwaelscappel Date: Thu, 5 Sep 2019 13:59:59 +0000 (+0200) Subject: wip #3005 @0:20 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=43ecf89d0410c2a3f7c07db58722c856deec7cbf;p=cubist_cms-back.git wip #3005 @0:20 --- 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;