Exemple #1
0
 /**
  * (non-PHPdoc).
  *
  * @see \Zend\View\Helper\Navigation\AbstractHelper::htmlify()
  */
 public function htmlify(AbstractPage $page, $hasParent = false)
 {
     $html = '<li';
     if (!$hasParent) {
         $html .= ' class="active"';
     }
     $html .= '>';
     $label = $page->getLabel();
     if (null !== ($translator = $this->getTranslator())) {
         $label = $translator->translate($label, $this->getTranslatorTextDomain());
     }
     $escaper = $this->view->plugin('escapeHtml');
     $label = $escaper($label);
     if ($page->getHref() && ($hasParent || !$hasParent && $this->getLinkLast()) && (!$page instanceof Uri || $page->getUri() != '#')) {
         $anchorAttribs = $this->htmlAttribs(['href' => $page->getHref()]);
         $html .= '<a' . $anchorAttribs . '>' . $label . '</a>';
     } else {
         $html .= $label;
     }
     $html .= '</li>';
     return $html;
 }