]> _ Git - cubist_cms-back.git/commitdiff
wip #3005 @0:20
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 5 Sep 2019 13:59:59 +0000 (15:59 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 5 Sep 2019 13:59:59 +0000 (15:59 +0200)
src/app/Magic/Menu/Menu.php
src/app/Magic/Menu/PageItem.php

index 417375df017cec66ac2694148fcdb8bbf1b8f689..1c707e4cf4e5ffad32832113c31ea8982310276e 100644 (file)
@@ -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('<span>'.$child->getTitle().'</span>');
+                $parent = $menu->raw('<span>' . $child->getTitle() . '</span>');
             }
             $this->makeMobileMenu($parent, $child, $depth - 1);
         }
index dcebaa9ad14fe358b7aafe25d598cae1f1828f61..9ec85c72af06c4cdbf24eb12d8e6685d37e331e3 100644 (file)
@@ -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;