Example #1
0
    /**
     * Returns HTML anchor for the given pages
     *
     * @param  Zym_Navigation_Page $page  page to get anchor for
     * @return string
     */
    public function getPageAnchor(Zym_Navigation_Page $page)
    {
        // get label and title for translating
        $label = $page->getLabel();
        $title = $page->getTitle();
        
        if ($this->_useTranslator && $t = $this->_getTranslator()) {
            $label = $t->translate($label);
            $title = $t->translate($title);
        }
        
        // get attribs for anchor element
        $attribs = array(
            'id'     => $page->getId(),
            'title'  => $title,
            'class'  => $page->getClass()
        );

        $href = $page->getHref();

        if ($href) {
            $attribs['href'] = $href;
            $attribs['target'] = $page->getTarget();
            $element = 'a';
        } else {
            $element = 'span';
        }

        return '<' . $element . ' ' . $this->_htmlAttribs($attribs) . '>'
             . $this->getView()->escape($label)
             . '</' . $element . '>';
    }
Example #2
0
 /**
  * Returns HTML anchor for the given pages
  *
  * @param  Zym_Navigation_Page $page  page to get anchor for
  * @return string
  */
 public function getPageAnchor(Zym_Navigation_Page $page)
 {
     // get attribs for anchor element
     $attribs = array('id' => $page->getId(), 'title' => $page->getTitle(), 'class' => $page->getClass());
     $href = $page->getHref();
     if ($href) {
         $attribs['href'] = $href;
         $attribs['target'] = $page->getTarget();
         $element = 'a';
     } else {
         $element = 'span';
     }
     return '<' . $element . ' ' . $this->_htmlAttribs($attribs) . '>' . $page->getLabel() . '</' . $element . '>';
 }
 /**
  * Returns HTML anchor for the given pages
  *
  * @param  Zym_Navigation_Page $page  page to get anchor for
  * @return string
  */
 public function getPageAnchor(Zym_Navigation_Page $page)
 {
     // get attribs for anchor element
     $attribs = array('id' => $page->getId(), 'title' => $page->getTitle(), 'class' => $page->getClass(), 'href' => $page->getHref(), 'target' => $page->getTarget());
     return '<a ' . $this->_htmlAttribs($attribs) . '>' . $page->getLabel() . '</a>';
 }