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