From: Vincent Vanwaelscappel Date: Thu, 2 Apr 2020 15:54:07 +0000 (+0200) Subject: wip #3520 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=69f28a3b355aa3487712af9084c8c81459963bfe;p=cubist_cms-back.git wip #3520 --- diff --git a/src/app/Magic/Menu/Item.php b/src/app/Magic/Menu/Item.php index 69ccc8b..a70e566 100644 --- a/src/app/Magic/Menu/Item.php +++ b/src/app/Magic/Menu/Item.php @@ -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 index 132e36e..0000000 --- a/src/app/Template/Model.php +++ /dev/null @@ -1,10 +0,0 @@ -