protected function addNextPage()
 {
     if ($this->nextLabel) {
         $nextPage = $this->page + 1;
         $options = [];
         if ($this->page == $this->pages) {
             $nextPage = $this->pages;
             $options['class'] = 'disabled';
         }
         $href = "{$this->href}/{$this->pageArgument}/{$nextPage}";
         $link = new Link($this->nextLabel, $href);
         $this->tag->addItem($link->render(), $options);
     }
     return $this;
 }
Example #2
0
 /**
  * 
  * @param mixed $content
  * @param mixed $options
  * @return \PhpBootstrap\Bootstrap\Dropdown
  */
 public function addItem($content, $options = null)
 {
     if ($options == 'HEADER') {
         $this->ul->addItem($content, ['role' => 'presentation', 'class' => 'dropdown-header']);
     } elseif ($options == 'DIVIDER') {
         $this->ul->addItem('', ['role' => 'presentation', 'class' => 'divider']);
     } else {
         $link = new Link($content, $options);
         $link->addAttribs(['role' => 'menuitem', 'tabindex' => '-1']);
         $this->ul->addItem($link->render(), ['role' => 'presentation']);
     }
     return $this;
 }
Example #3
0
 public function testSetHrefAndTarget()
 {
     $link = new Link('click me', '#');
     $link->href('/localhost/test')->target('_blank');
     $this->assertEquals('<a href="/localhost/test" target="_blank">click me</a>', $link->render());
 }