]> _ Git - cubist_cms-back.git/commitdiff
wip #3520
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 2 Apr 2020 15:54:07 +0000 (17:54 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 2 Apr 2020 15:54:07 +0000 (17:54 +0200)
src/app/Magic/Menu/Item.php
src/app/Template/Model.php [deleted file]

index 69ccc8b3c3913a1312ae4ab51d0ecb06e2f21801..a70e56652c67e4766e060f6aac768f777296955f 100644 (file)
@@ -48,6 +48,11 @@ class Item
 
     protected $_href = '';
 
+    /**
+     * @var string
+     */
+    protected $_canonical = '';
+
     /**
      * @var array
      */
@@ -420,10 +425,37 @@ class Item
         $this->_href = $href;
     }
 
+    /**
+     * @return string
+     */
+    public function getCanonical(): string
+    {
+        return $this->_canonical;
+    }
+
+    /**
+     * @param string $canonical
+     */
+    public function setCanonical(string $canonical): void
+    {
+        $this->_canonical = $canonical;
+    }
+
+    public function getCanonicalURL(): string
+    {
+        $canonical = $this->getCanonical() || $this->getHref();
+        return $this->_getURL($canonical);
+    }
+
     public function getURL()
+    {
+        return $this->_getURL($this->getHref());
+    }
+
+    protected function _getURL($href)
     {
         $domain = Locale::getMainDomain($this->getLocale(), $this->getVariant());
-        $href = $this->getHref();
+
         if ($href === 'home') {
             $href = '';
         }
diff --git a/src/app/Template/Model.php b/src/app/Template/Model.php
deleted file mode 100644 (file)
index 132e36e..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-<?php
-
-
-namespace Cubist\Backpack\app\Template;
-
-
-class Model extends TemplateAbstract
-{
-
-}