|
|
|
@ -8,6 +8,7 @@
|
|
|
|
|
namespace yii\bootstrap; |
|
|
|
|
|
|
|
|
|
use yii\helpers\ArrayHelper; |
|
|
|
|
use yii\helpers\Url; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* ButtonDropdown renders a group or split button dropdown bootstrap component. |
|
|
|
@ -104,11 +105,12 @@ class ButtonDropdown extends Widget
|
|
|
|
|
if ($this->encodeLabel) { |
|
|
|
|
$label = Html::encode($label); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if ($this->split) { |
|
|
|
|
$options = $this->options; |
|
|
|
|
$this->options['data-toggle'] = 'dropdown'; |
|
|
|
|
Html::addCssClass($this->options, ['toggle' => 'dropdown-toggle']); |
|
|
|
|
unset($this->options['id']); |
|
|
|
|
unset($options['id']); |
|
|
|
|
$splitButton = Button::widget([ |
|
|
|
|
'label' => '<span class="caret"></span>', |
|
|
|
|
'encodeLabel' => false, |
|
|
|
@ -118,14 +120,21 @@ class ButtonDropdown extends Widget
|
|
|
|
|
} else { |
|
|
|
|
$label .= ' <span class="caret"></span>'; |
|
|
|
|
$options = $this->options; |
|
|
|
|
if (!isset($options['href']) && $this->tagName === 'a') { |
|
|
|
|
$options['href'] = '#'; |
|
|
|
|
} |
|
|
|
|
Html::addCssClass($options, ['toggle' => 'dropdown-toggle']); |
|
|
|
|
$options['data-toggle'] = 'dropdown'; |
|
|
|
|
$splitButton = ''; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (isset($options['href'])) { |
|
|
|
|
if (is_array($options['href'])) { |
|
|
|
|
$options['href'] = Url::to($options['href']); |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
if ($this->tagName === 'a') { |
|
|
|
|
$options['href'] = '#'; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return Button::widget([ |
|
|
|
|
'tagName' => $this->tagName, |
|
|
|
|
'label' => $label, |
|
|
|
|