From 2888d98221889155c103f69ff9224b39cd69a3df Mon Sep 17 00:00:00 2001 From: fly Date: Wed, 29 Oct 2014 14:03:40 +0300 Subject: [PATCH] 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). --- ButtonGroup.php | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/ButtonGroup.php b/ButtonGroup.php index 7066b96..ebbe0a5 100644 --- a/ButtonGroup.php +++ b/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; }