Browse Source

Pass all the button's config array to Button::widget() instead of creating new one item by item. Now allowed to pass in ButtonGroup button's configs any possible attributes(like tagName, encodeLabel, etc).

tags/2.0.1
fly 10 years ago committed by Qiang Xue
parent
commit
2888d98221
  1. 13
      ButtonGroup.php

13
ButtonGroup.php

@ -7,7 +7,6 @@
namespace yii\bootstrap;
use yii\helpers\ArrayHelper;
use yii\helpers\Html;
/**
@ -81,14 +80,10 @@ class ButtonGroup extends Widget
$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;
}

Loading…
Cancel
Save