Exemplo n.º 1
0
 /**
  * Get the li and link html for a link
  *
  * @param \RcmDynamicNavigation\Model\NavLink $link Link to render
  * @param boolean $admin Render in admin mode
  *
  * @return string
  */
 protected function getLi(NavLink $link, $admin)
 {
     $target = $link->getTarget();
     $objectClass = $link->getClass();
     $systemClass = $link->getSystemClass();
     if ($link->hasLinks()) {
         $objectClass .= ' dropdown';
     }
     $permissionsArray = $link->getPermissions();
     $html = '<li';
     if (!empty($objectClass) || !empty($systemClass)) {
         $html .= ' class="' . $objectClass . ' ' . $systemClass . '"';
     }
     if ($admin) {
         $html .= ' data-permissions="' . implode(',', $permissionsArray) . '"';
     }
     $html .= '>' . "\n";
     $html .= '<a href="' . $link->getHref() . '"';
     if ($link->hasLinks()) {
         $html .= 'class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false"';
     }
     if (!empty($target)) {
         $html .= ' target="' . $target . '"';
     }
     $html .= '>';
     $html .= '<span class="linkText">' . $link->getDisplay() . '</span>';
     if ($link->hasLinks()) {
         $html .= '<span class="caret"></span>';
     }
     $html .= '</a>' . "\n";
     if ($link->hasLinks()) {
         $html .= $this->getUl($link->getLinks(), $admin);
     }
     $html .= '</li>' . "\n";
     return $html;
 }
Exemplo n.º 2
0
 /**
  * Test Set And Get Href
  *
  * @return void
  * @covers \RcmDynamicNavigation\Model\NavLink::getHref
  * @covers \RcmDynamicNavigation\Model\NavLink::setHref
  */
 public function testSetAndGetHref()
 {
     $href = '/somewhere';
     $this->link->setHref($href);
     $this->assertEquals($href, $this->link->getHref());
 }