Commit 4e64b238 by niskac

added support for hiding prev and next in BootCarousel

parent 137a0f42
...@@ -22,6 +22,10 @@ class BootCarousel extends CWidget ...@@ -22,6 +22,10 @@ class BootCarousel extends CWidget
*/ */
public $next = '›'; public $next = '›';
/** /**
* @var boolean whether to display the previous and next links.
*/
public $displayPrevAndNext = true;
/**
* @var array the carousel items configuration. * @var array the carousel items configuration.
*/ */
public $items = array(); public $items = array();
...@@ -64,10 +68,14 @@ class BootCarousel extends CWidget ...@@ -64,10 +68,14 @@ class BootCarousel extends CWidget
echo CHtml::openTag('div', $this->htmlOptions); echo CHtml::openTag('div', $this->htmlOptions);
echo '<div class="carousel-inner">'; echo '<div class="carousel-inner">';
$this->renderItems($this->items); $this->renderItems($this->items);
echo '</div>';
echo '<a class="carousel-control left" href="#'.$id.'" data-slide="prev">'.$this->prev.'</a>'; if ($this->displayPrevAndNext)
echo '<a class="carousel-control right" href="#'.$id.'" data-slide="next">'.$this->next.'</a>'; {
echo '</div>'; echo '</div>';
echo '<a class="carousel-control left" href="#'.$id.'" data-slide="prev">'.$this->prev.'</a>';
echo '<a class="carousel-control right" href="#'.$id.'" data-slide="next">'.$this->next.'</a>';
echo '</div>';
}
/** @var CClientScript $cs */ /** @var CClientScript $cs */
$cs = Yii::app()->getClientScript(); $cs = Yii::app()->getClientScript();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment