BootstrapWidgetTrait
BootstrapWidgetTrait is the trait, which provides basic for all bootstrap widgets features.
Note: class, which uses this trait must declare public field named options
with the array default value:
class MyWidget extends \yii\base\Widget
{
use BootstrapWidgetTrait;
public $options = [];
}
This field is not present in the trait in order to avoid possible PHP Fatal error on definition conflict.
Tags
Table of Contents
Properties
- $clientEvents : array<string|int, mixed>
- $clientOptions : array<string|int, mixed>
Methods
- getView() : View
- init() : mixed
- Initializes the widget.
- registerClientEvents() : mixed
- Registers JS event handlers that are listed in [[clientEvents]].
- registerPlugin() : mixed
- Registers a specific Bootstrap plugin and the related events
Properties
$clientEvents
public
array<string|int, mixed>
$clientEvents
= []
the event handlers for the underlying Bootstrap JS plugin. Please refer to the corresponding Bootstrap plugin Web page for possible events. For example, this page shows how to use the "Modal" plugin and the supported events (e.g. "shown").
$clientOptions
public
array<string|int, mixed>
$clientOptions
= []
the options for the underlying Bootstrap JS plugin. Please refer to the corresponding Bootstrap plugin Web page for possible options. For example, this page shows how to use the "Modal" plugin and the supported options (e.g. "remote").
Methods
getView()
public
abstract getView() : View
Tags
Return values
View —the view object that can be used to render views or view files.
init()
Initializes the widget.
public
init() : mixed
This method will register the bootstrap asset bundle. If you override this method, make sure you call the parent implementation first.
registerClientEvents()
Registers JS event handlers that are listed in [[clientEvents]].
protected
registerClientEvents() : mixed
Tags
registerPlugin()
Registers a specific Bootstrap plugin and the related events
protected
registerPlugin(string $name) : mixed
Parameters
- $name : string
-
the name of the Bootstrap plugin