/** * Adds a link from a NavigationItem instance. * * @param NavigationItem $item * @param UrlParameterBag $urlParameterBag */ public function addFromNavigationItem(NavigationItem $item, UrlParameterBag $urlParameterBag) { $this->add($item->getLanguageTag(), $item->getHref($urlParameterBag), $item->getTitle()); }
/** * Generates array suitable for nav_default template. * * @param NavigationItem $item * @param UrlParameterBag $urlParameterBag * * @return array */ protected function generateTemplateArray(NavigationItem $item, UrlParameterBag $urlParameterBag) { return ['isActive' => $item->isCurrentPage(), 'class' => 'lang-' . $item->getNormalizedLanguage() . ($item->isDirectFallback() ? '' : ' nofallback') . ($item->isCurrentPage() ? ' active' : ''), 'link' => $item->getLabel(), 'subitems' => '', 'href' => specialchars($item->getHref($urlParameterBag)), 'pageTitle' => strip_tags($item->getTitle()), 'accesskey' => '', 'tabindex' => '', 'nofollow' => false, 'target' => ($item->isNewWindow() ? ' target="_blank"' : '') . ' hreflang="' . $item->getLanguageTag() . '" lang="' . $item->getLanguageTag() . '"', 'item' => $this]; }