Example #1
0
 /**
  * Creates a menu item link element
  *
  * @param Menu $menu
  *
  * @return string
  */
 public function createLink(Menu $menu)
 {
     if ($menu->getIcon() && strpos($menu->getIcon(), '.') === false) {
         return sprintf('<a href="%s"%s><i aria-hidden="true" class="icon-%s"></i>%s</a>', $menu->getUrl() ?: '#', $this->getAttributes(), $menu->getIcon(), $this->getView()->escape($menu->getTitle()));
     }
     return sprintf('<a href="%s"%s>%s%s<span></span></a>', $menu->getUrl() ?: '#', $this->getAttributes(), $menu->getIcon() ? '<img aria-hidden="true" src="' . Url::fromPath($menu->getIcon()) . '" class="icon" /> ' : '', $this->getView()->escape($menu->getTitle()));
 }