/** * Render the carousel */ public function run() { parent::run(); if (is_array($this->items) and count($this->items)) { EBootstrap::mergeClass($this->htmlOptions, array('carousel')); echo EBootstrap::openTag('div', $this->htmlOptions) . "\n"; echo EBootstrap::openTag('div', array('class' => 'carousel-inner')) . "\n"; foreach ($this->items as $item) { $itemOptions = isset($item['htmlOptions']) ? $item['htmlOptions'] : array(); EBootstrap::mergeClass($itemOptions, array('item')); if (isset($item['active']) and $item['active'] == true) { EBootstrap::mergeClass($itemOptions, array('active')); } echo EBootstrap::openTag('div', $itemOptions) . "\n"; if (!isset($item['alt'])) { $item['alt'] = isset($item['caption']) ? $item['caption'] : ''; } if (isset($item['href'])) { echo EBootstrap::openTag('a', array('href' => $item['href'])); } echo EBootstrap::image($item['src'], $item['alt'], array()) . "\n"; if (isset($item['caption']) and !empty($item['caption']) or isset($item['body']) and !empty($item['body'])) { echo EBootstrap::openTag('div', array('class' => 'carousel-caption')); if (isset($item['caption']) and !empty($item['caption'])) { echo EBootstrap::tag('h4', array(), $item['caption']) . "\n"; } if (isset($item['body']) and !empty($item['body'])) { echo EBootstrap::tag('p', array(), $item['body']) . "\n"; } echo EBootstrap::closeTag('div'); } if (isset($item['href'])) { echo EBootstrap::closeTag('a'); } echo EBootstrap::closeTag('div') . "\n"; } echo EBootstrap::closeTag('div') . "\n"; echo EBootstrap::link($this->controlPrev, '#' . $this->htmlOptions['id'], array('data-slide' => 'prev', 'class' => 'left carousel-control')) . "\n"; echo EBootstrap::link($this->controlNext, '#' . $this->htmlOptions['id'], array('data-slide' => 'next', 'class' => 'right carousel-control')) . "\n"; echo EBootstrap::closeTag('div') . "\n"; } }