コード例 #1
0
 public function render()
 {
     if (!$this->tag->getAttrib('id')) {
         $this->id(uniqid());
     }
     if (!$this->hideIndicators) {
         foreach ($this->indicators->getItems() as $num => $item) {
             $item->data('target', '#' . $this->getAttrib('id'));
             $item->data('slide-to', $num);
         }
         $this->append($this->indicators);
     }
     $this->append($this->inner);
     if (!$this->hideControls) {
         $this->appendControls();
     }
     return $this->tag->render();
 }
コード例 #2
0
ファイル: OlTest.php プロジェクト: mysmbhelpdesk/PhpBootstrap
 public function testSetAndGetItemsAndAddItem()
 {
     $list = new Ol(['item 1', 'item 2']);
     $list->addItem('item 3', ['class' => 'teste']);
     $list->addItem(['class' => 'teste']);
     $list->addItem(['content' => 'item 5', 'class' => 'teste']);
     $expected = '<ol><li>item 1</li><li>item 2</li>' . '<li class="teste">item 3</li>' . '<li class="teste"></li>' . '<li class="teste">item 5</li></ol>';
     $items = $list->getItems();
     $this->assertCount(5, $items);
     $this->assertInstanceOf('\\PhpBootstrap\\Html\\Tag', $items[0]);
     $this->assertEquals('li', $items[0]->getTag());
     $this->assertEquals($expected, $list->render());
 }