Trait yii\bootstrap5\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.
Public Properties
Property | Type | Description | Defined By |
---|---|---|---|
$clientEvents | array | The event handlers for the underlying Bootstrap JS plugin. | yii\bootstrap5\BootstrapWidgetTrait |
$clientOptions | array|boolean | The options for the underlying Bootstrap JS plugin. | yii\bootstrap5\BootstrapWidgetTrait |
Public Methods
Method | Description | Defined By |
---|---|---|
init() | Initializes the widget. | yii\bootstrap5\BootstrapWidgetTrait |
Protected Methods
Method | Description | Defined By |
---|---|---|
registerClientEvents() | Registers JS event handlers that are listed in $clientEvents. | yii\bootstrap5\BootstrapWidgetTrait |
registerPlugin() | Registers a specific Bootstrap plugin and the related events | yii\bootstrap5\BootstrapWidgetTrait |
Property Details
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").
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"). If this property is false, registerJs will not be called on the view to initialize the module.
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 ( ) | ||
throws | yii\base\InvalidConfigException |
---|
Registers JS event handlers that are listed in $clientEvents.
protected void registerClientEvents ( ) |
Registers a specific Bootstrap plugin and the related events
protected void registerPlugin ( \yii\bootstrap5\string $name ) | ||
$name | string | The name of the Bootstrap plugin |