Trait kartik\base\WidgetTrait
Implemented by | kartik\base\Html5Input, kartik\base\InputWidget, kartik\base\Widget, kartik\select2\Select2, kartik\tree\TreeView, kartik\tree\TreeViewInput |
---|---|
Available since version | 1.6.0 |
Trait used for Krajee widgets.
Protected Methods
Method | Description | Defined By |
---|---|---|
addAsset() | Adds an asset to the view | kartik\base\WidgetTrait |
getPluginScript() | Returns the plugin registration script | kartik\base\WidgetTrait |
hashPluginOptions() | Generates a hashed variable to store the pluginOptions. The following special data attributes will also be setup for the input widget, that can be accessed through javascript : - 'data-krajee-{name}' will store the hashed variable storing the plugin options. The {name} tag will represent the plugin name (e.g. select2, typeahead etc.) - Fixes issue #6. | kartik\base\WidgetTrait |
registerPlugin() | Registers a specific plugin and the related events | kartik\base\WidgetTrait |
registerPluginOptions() | Registers plugin options by storing it in a hashed javascript variable | kartik\base\WidgetTrait |
setDataVar() | Sets HTML5 data variable | kartik\base\WidgetTrait |
Method Details
Adds an asset to the view
protected void addAsset ( $view, $file, $type, $class ) | ||
$view | \yii\web\View | The View object |
$file | string | The asset file name |
$type | string | The asset file type (css or js) |
$class | string | The class name of the AssetBundle |
Returns the plugin registration script
protected \kartik\base\the getPluginScript ( $name, $element = null, $callback = null, $callbackCon = null ) | ||
$name | string | The name of the plugin |
$element | string | The plugin target element |
$callback | string | The javascript callback function to be called after plugin loads |
$callbackCon | string | The javascript callback function to be passed to the plugin constructor |
return | \kartik\base\the | Generated plugin script |
---|
Generates a hashed variable to store the pluginOptions. The following special data attributes will also be setup for the input widget, that can be accessed through javascript : - 'data-krajee-{name}' will store the hashed variable storing the plugin options. The {name} tag will represent the plugin name (e.g. select2, typeahead etc.) - Fixes issue #6.
protected void hashPluginOptions ( $name ) | ||
$name | string | The name of the plugin |
Registers a specific plugin and the related events
protected void registerPlugin ( $name, $element = null, $callback = null, $callbackCon = null ) | ||
$name | string | The name of the plugin |
$element | string | The plugin target element |
$callback | string | The javascript callback function to be called after plugin loads |
$callbackCon | string | The javascript callback function to be passed to the plugin constructor |
Registers plugin options by storing it in a hashed javascript variable
protected void registerPluginOptions ( $name ) | ||
$name |
Sets HTML5 data variable
protected void setDataVar ( $name ) | ||
$name | string | The plugin name |