Beispiel #1
0
 /**
  * @param Fraym\Menu\Entity\MenuItem $menuItem
  * @param bool $withProtocol
  * @return string
  */
 public function buildFullUrl($menuItem, $withProtocol = false)
 {
     if ($menuItem->getCurrentTranslation() && $menuItem->getCurrentTranslation()->externalUrl) {
         return $menuItem->getCurrentTranslation()->url;
     }
     $url = rtrim($this->getCurrentDomain(), '/') . '/' . ($menuItem->getCurrentTranslation() ? ltrim($menuItem->getCurrentTranslation()->url, '/') : '');
     if ($withProtocol === true) {
         $url = ($menuItem->https ? 'https://' : 'http://') . $url;
     }
     return $url;
 }