Esempio n. 1
0
 public function render()
 {
     if (!empty($this->_items)) {
         $indicators = new Lists(Lists::LIST_UNSTYLED);
         $indicators->set_tag('ol');
         $indicators->add_class('carousel-indicators');
         foreach ($this->_items as $key => $item) {
             if ($key == 0) {
                 $indicators->add_item('', Lists::ITEM_ACTIVE, array('data-target' => '#' . $this->_attributes['id'], 'data-slide-to' => $key));
                 $slides[$key] = new Tag('div', $item, ['class' => 'item active']);
             } else {
                 $indicators->add_item('', array('data-target' => '#' . $this->_attributes['id'], 'data-slide-to' => $key));
                 $slides[$key] = new Tag('div', $item, ['class' => 'item']);
             }
         }
         $slide = new Tag('div', implode(PHP_EOL, $slides), ['class' => 'carousel-inner', 'role' => 'listbox']);
         $controls['left'] = new Link(implode(PHP_EOL, array(new Tag('span', ['class' => 'glyphicon glyphicon-chevron-left', 'aria-hidden' => TRUE]), new Tag('span', 'Previous', ['class' => 'sr-only']))), ['class' => 'left carousel-control', 'href' => '#' . $this->_attributes['id'], 'role' => 'button', 'data-slide' => 'prev']);
         $controls['right'] = new Link(implode(PHP_EOL, array(new Tag('span', ['class' => 'glyphicon glyphicon-chevron-right', 'aria-hidden' => TRUE]), new Tag('span', 'Next', ['class' => 'sr-only']))), ['class' => 'right carousel-control', 'href' => '#' . $this->_attributes['id'], 'role' => 'button', 'data-slide' => 'next']);
         return (new Tag($this->_tag, implode(PHP_EOL, array($indicators, $slide)), $this->_attributes))->render();
     }
     return '';
 }