Skip to content

Commit

Permalink
Pass all the button's config array to Button::widget() instead of cre…
Browse files Browse the repository at this point in the history
…ating new one item by item. Now allowed to pass in ButtonGroup button's configs any possible attributes(like tagName, encodeLabel, etc).
  • Loading branch information
aleksanderd authored and qiangxue committed Nov 12, 2014
1 parent 4e47b67 commit d36bf9e
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions extensions/bootstrap/ButtonGroup.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

namespace yii\bootstrap;

use yii\helpers\ArrayHelper;
use yii\helpers\Html;

/**
Expand Down Expand Up @@ -81,14 +80,10 @@ protected function renderButtons()
$buttons = [];
foreach ($this->buttons as $button) {
if (is_array($button)) {
$label = ArrayHelper::getValue($button, 'label');
$options = ArrayHelper::getValue($button, 'options');
$buttons[] = Button::widget([
'label' => $label,
'options' => $options,
'encodeLabel' => $this->encodeLabels,
'view' => $this->getView()
]);
$button['view'] = $this->getView();
if (!isset($button['encodeLabel']))
$button['encodeLabel'] = $this->encodeLabels;
$buttons[] = Button::widget($button);
} else {
$buttons[] = $button;
}
Expand Down

0 comments on commit d36bf9e

Please sign in to comment.