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 class for widgets extending \yii\base\Widget used in Krajee extensions.

Public Properties

Hide inherited properties

PropertyTypeDescriptionDefined By
$enablePopStateFix boolean Enable pop state fix for pjax container on press of browser back & forward buttons. kartik\base\Widget
$i18n array The the internalization configuration for this widget. kartik\base\Widget
$options array HTML attributes or other settings for widgets. kartik\base\Widget
$pjaxContainerId string A pjax container identifier if applicable inside which the widget will be rendered. kartik\base\Widget
$pluginDestroyJs string The javascript that will be used to destroy the jQuery plugin kartik\base\Widget
$pluginEvents array Widget JQuery events. kartik\base\Widget
$pluginName string The name of the jQuery plugin. kartik\base\Widget
$pluginOptions array Widget plugin options. kartik\base\Widget

Protected Properties

Hide inherited properties

PropertyTypeDescriptionDefined By
$_dataVar string The HTML5 data variable name that will be used to store the Json encoded pluginOptions within the element on which the jQuery plugin will be initialized. kartik\base\Widget
$_encOptions string The JSON encoded plugin options. kartik\base\Widget
$_hashVar string The generated hashed variable name that will store the JSON encoded pluginOptions in \kartik\base\View::POS_HEAD. kartik\base\Widget
$_msgCat string Translation message file category name for i18n. 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
registerWidgetJs() Registers a JS code block for the widget. kartik\base\WidgetTrait

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 : kartik\base\WidgetTrait
initDestroyJs() Generates the pluginDestroyJs script if it is not set. kartik\base\WidgetTrait
registerPlugin() Registers a specific plugin and the related events kartik\base\WidgetTrait
registerPluginOptions() Registers plugin options by storing within a uniquely generated javascript variable. kartik\base\WidgetTrait
setDataVar() Sets a HTML5 data variable. kartik\base\WidgetTrait

Property Details

$_dataVar protected property

The HTML5 data variable name that will be used to store the Json encoded pluginOptions within the element on which the jQuery plugin will be initialized.

protected string $_dataVar null
$_encOptions protected property

The JSON encoded plugin options.

protected string $_encOptions ''
$_hashVar protected property

The generated hashed variable name that will store the JSON encoded pluginOptions in \kartik\base\View::POS_HEAD.

protected string $_hashVar null
$_msgCat protected property

Translation message file category name for i18n.

See also [[\yii\i18n\I18N]].

protected string $_msgCat ''
$enablePopStateFix public property

Enable pop state fix for pjax container on press of browser back & forward buttons.

$i18n public property

The the internalization configuration for this widget.

See also [[\yii\i18n\I18N]] component for understanding the configuration details.

public array $i18n = []
$options public property

HTML attributes or other settings for widgets.

public array $options = []
$pjaxContainerId public property

A pjax container identifier if applicable inside which the widget will be rendered. If this is set, the widget will automatically reinitialize on pjax render completion.

public string $pjaxContainerId null
$pluginDestroyJs public property

The javascript that will be used to destroy the jQuery plugin

public string $pluginDestroyJs null
$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 = []
$pluginName public property

The name of the jQuery plugin.

public string $pluginName ''
$pluginOptions public property

Widget plugin options.

public array $pluginOptions = []

Method Details

init() public method

public void init ( )