Browse Source

Fixes #4362: Made carousel indicators optional

tags/2.0.0-rc
Serge Postrash 10 years ago committed by Alexander Makarov
parent
commit
5e10e2833b
  1. 1
      CHANGELOG.md
  2. 8
      Carousel.php

1
CHANGELOG.md

@ -10,6 +10,7 @@ Yii Framework 2 bootstrap extension Change Log
- Enh #4024: Added ability to `yii\bootstrap\Tabs` to encode each `Tabs::items['label']` separately (creocoder, umneeq) - Enh #4024: Added ability to `yii\bootstrap\Tabs` to encode each `Tabs::items['label']` separately (creocoder, umneeq)
- Chg #3036: Upgraded Twitter Bootstrap to 3.1.x (qiangxue) - Chg #3036: Upgraded Twitter Bootstrap to 3.1.x (qiangxue)
- Enh #4120: Added ability for each item to choose it's encoding option in `Dropdown` and `Nav` (Alex-Code) - Enh #4120: Added ability for each item to choose it's encoding option in `Dropdown` and `Nav` (Alex-Code)
- Enh #4363: Added `showIndicators` property to make Carousel indicators optional (sdkiller)
2.0.0-beta April 13, 2014 2.0.0-beta April 13, 2014
------------------------- -------------------------

8
Carousel.php

@ -45,6 +45,11 @@ class Carousel extends Widget
*/ */
public $controls = ['‹', '›']; public $controls = ['‹', '›'];
/** /**
* @var boolean
* If false carousel indicators (<ol> tag with anchors to items) should not be displayed.
*/
public $showIndicators = true;
/**
* @var array list of slides in the carousel. Each array element represents a single * @var array list of slides in the carousel. Each array element represents a single
* slide with the following structure: * slide with the following structure:
* *
@ -89,6 +94,9 @@ class Carousel extends Widget
*/ */
public function renderIndicators() public function renderIndicators()
{ {
if ($this->showIndicators === false) {
return '';
}
$indicators = []; $indicators = [];
for ($i = 0, $count = count($this->items); $i < $count; $i++) { for ($i = 0, $count = count($this->items); $i < $count; $i++) {
$options = ['data-target' => '#' . $this->options['id'], 'data-slide-to' => $i]; $options = ['data-target' => '#' . $this->options['id'], 'data-slide-to' => $i];

Loading…
Cancel
Save