Class kartik\base\Widget

Inheritancekartik\base\Widget » yii\base\Widget
Uses Traitskartik\base\TranslationTrait, kartik\base\WidgetTrait
Subclasseskartik\tree\TreeView, kartik\tree\TreeViewInput
Available since version1.0

Base widget class for Krajee extensions

Public Properties

Hide inherited properties

PropertyTypeDescriptionDefined By
$i18n array The the internalization configuration for this widget kartik\base\Widget
$options array HTML attributes or other settings for widgets kartik\base\Widget
$pluginEvents array Widget JQuery events. kartik\base\Widget
$pluginOptions array Widget plugin options kartik\base\Widget

Protected Properties

Hide inherited properties

PropertyTypeDescriptionDefined By
$_dataVar string The element's HTML5 data variable name storing the pluginOptions kartik\base\Widget
$_encOptions string The Json encoded options kartik\base\Widget
$_hashVar string The hashed global variable name storing the pluginOptions kartik\base\Widget
$_msgCat string Translation message file category name for i18n kartik\base\Widget
$_pluginName string The name of the jQuery plugin kartik\base\Widget

Public Methods

Hide inherited methods

MethodDescriptionDefined By
init() kartik\base\Widget
initI18N() Yii i18n messages configuration for generating translations kartik\base\TranslationTrait

Protected Methods

Hide inherited methods

MethodDescriptionDefined 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

Property Details

$_dataVar protected property

The element's HTML5 data variable name storing the pluginOptions

protected string $_dataVar null
$_encOptions protected property

The Json encoded options

protected string $_encOptions ''
$_hashVar protected property

The hashed global variable name storing the pluginOptions

protected string $_hashVar null
$_msgCat protected property

Translation message file category name for i18n

protected string $_msgCat ''
$_pluginName protected property

The name of the jQuery plugin

protected string $_pluginName null
$i18n public property

The the internalization configuration for this widget

public array $i18n = []
$options public property

HTML attributes or other settings for widgets

public array $options = []
$pluginEvents public property

Widget JQuery events. You must define events in event-name => event-function format for example: ~~~ pluginEvents = [

"change" => "function() { log("change"); }",
"open" => "function() { log("open"); }",

]; ~~~

public array $pluginEvents = []
$pluginOptions public property

Widget plugin options

public array $pluginOptions = []

Method Details

init() public method

public void init ( )