|
|
@ -7,6 +7,7 @@ |
|
|
|
|
|
|
|
|
|
|
|
namespace yii\bootstrap; |
|
|
|
namespace yii\bootstrap; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
use yii\helpers\ArrayHelper; |
|
|
|
use yii\helpers\Html; |
|
|
|
use yii\helpers\Html; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -38,6 +39,15 @@ class ButtonDropdown extends Widget |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public $label = 'Button'; |
|
|
|
public $label = 'Button'; |
|
|
|
/** |
|
|
|
/** |
|
|
|
|
|
|
|
* @var array the HTML attributes for the container tag. The following special options are recognized: |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* - tag: string, defaults to "div", the name of the container tag. |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* @see \yii\helpers\Html::renderTagAttributes() for details on how attributes are being rendered. |
|
|
|
|
|
|
|
* @since 2.0.1 |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
public $containerOptions = []; |
|
|
|
|
|
|
|
/** |
|
|
|
* @var array the HTML attributes of the button. |
|
|
|
* @var array the HTML attributes of the button. |
|
|
|
* @see \yii\helpers\Html::renderTagAttributes() for details on how attributes are being rendered. |
|
|
|
* @see \yii\helpers\Html::renderTagAttributes() for details on how attributes are being rendered. |
|
|
|
*/ |
|
|
|
*/ |
|
|
@ -65,10 +75,14 @@ class ButtonDropdown extends Widget |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public function run() |
|
|
|
public function run() |
|
|
|
{ |
|
|
|
{ |
|
|
|
echo Html::beginTag('div', ['class' => 'btn-group']); |
|
|
|
Html::addCssClass($this->containerOptions, 'btn-group'); |
|
|
|
|
|
|
|
$options = $this->containerOptions; |
|
|
|
|
|
|
|
$tag = ArrayHelper::remove($options, 'tag', 'div'); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
echo Html::beginTag($tag, $this->containerOptions); |
|
|
|
echo "\n" . $this->renderButton(); |
|
|
|
echo "\n" . $this->renderButton(); |
|
|
|
echo "\n" . $this->renderDropdown(); |
|
|
|
echo "\n" . $this->renderDropdown(); |
|
|
|
echo "\n" . Html::endTag('div'); |
|
|
|
echo "\n" . Html::endTag($tag); |
|
|
|
$this->registerPlugin('button'); |
|
|
|
$this->registerPlugin('button'); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|