Class yii\bootstrap4\ButtonDropdown
Inheritance | yii\bootstrap4\ButtonDropdown » yii\bootstrap4\Widget » yii\base\Widget |
---|---|
Uses Traits | yii\bootstrap4\BootstrapWidgetTrait |
ButtonDropdown renders a group or split button dropdown bootstrap component.
For example,
// a button group using Dropdown widget
echo ButtonDropdown::widget([
'label' => 'Action',
'dropdown' => [
'items' => [
['label' => 'DropdownA', 'url' => '/'],
['label' => 'DropdownB', 'url' => '#'],
],
],
]);
See also:
Public Properties
Property | Type | Description | Defined By |
---|---|---|---|
$buttonOptions | array | The HTML attributes of the button. | yii\bootstrap4\ButtonDropdown |
$clientEvents | array | The event handlers for the underlying Bootstrap JS plugin. | yii\bootstrap4\BootstrapWidgetTrait |
$clientOptions | array | The options for the underlying Bootstrap JS plugin. | yii\bootstrap4\BootstrapWidgetTrait |
$direction | string | The drop-direction of the widget Possible values are 'left', 'right', 'up', or 'down' (default) | yii\bootstrap4\ButtonDropdown |
$dropdown | array | The configuration array for yii\bootstrap4\Dropdown. | yii\bootstrap4\ButtonDropdown |
$dropdownClass | string | Name of a class to use for rendering dropdowns withing this widget. | yii\bootstrap4\ButtonDropdown |
$encodeLabel | boolean | Whether the label should be HTML-encoded. | yii\bootstrap4\ButtonDropdown |
$label | string | The button label | yii\bootstrap4\ButtonDropdown |
$options | array | The HTML attributes for the container tag. | yii\bootstrap4\ButtonDropdown |
$renderContainer | boolean | Whether to render the container using the $options as HTML attributes. | yii\bootstrap4\ButtonDropdown |
$split | boolean | Whether to display a group of split-styled button group. | yii\bootstrap4\ButtonDropdown |
$tagName | string | The tag to use to render the button | yii\bootstrap4\ButtonDropdown |
Public Methods
Method | Description | Defined By |
---|---|---|
getView() | yii\bootstrap4\BootstrapWidgetTrait | |
init() | Initializes the widget. | yii\bootstrap4\ButtonDropdown |
run() | yii\bootstrap4\ButtonDropdown |
Protected Methods
Method | Description | Defined By |
---|---|---|
registerClientEvents() | Registers JS event handlers that are listed in $clientEvents. | yii\bootstrap4\BootstrapWidgetTrait |
registerPlugin() | Registers a specific Bootstrap plugin and the related events | yii\bootstrap4\BootstrapWidgetTrait |
renderButton() | Generates the button dropdown. | yii\bootstrap4\ButtonDropdown |
renderDropdown() | Generates the dropdown menu. | yii\bootstrap4\ButtonDropdown |
Constants
Constant | Value | Description | Defined By |
---|---|---|---|
DIRECTION_DOWN | 'down' | The css class part of dropdown | yii\bootstrap4\ButtonDropdown |
DIRECTION_LEFT | 'left' | The css class part of dropleft | yii\bootstrap4\ButtonDropdown |
DIRECTION_RIGHT | 'right' | The css class part of dropright | yii\bootstrap4\ButtonDropdown |
DIRECTION_UP | 'up' | The css class part of dropup | yii\bootstrap4\ButtonDropdown |
Property Details
The HTML attributes of the button.
See also \yii\helpers\Html::renderTagAttributes() for details on how attributes are being rendered.
The drop-direction of the widget
Possible values are 'left', 'right', 'up', or 'down' (default)
The configuration array for yii\bootstrap4\Dropdown.
Name of a class to use for rendering dropdowns withing this widget. Defaults to yii\bootstrap4\Dropdown.
Whether the label should be HTML-encoded.
The button label
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 also \yii\helpers\Html::renderTagAttributes() for details on how attributes are being rendered.
Whether to render the container using the $options as HTML attributes. If set to false
,
the container element enclosing the button and dropdown will NOT be rendered.
Whether to display a group of split-styled button group.
The tag to use to render the button
Method Details
Initializes the widget.
This method will register the bootstrap asset bundle. If you override this method, make sure you call the parent implementation first.
public void init ( ) |
Generates the button dropdown.
protected string renderButton ( ) | ||
return | string | The rendering result. |
---|---|---|
throws | Exception |
Generates the dropdown menu.
protected string renderDropdown ( ) | ||
return | string | The rendering result. |
---|---|---|
throws | Exception |
public void run ( ) | ||
throws | Exception |
---|