Class kartik\base\InputWidget
Inheritance | kartik\base\InputWidget » yii\widgets\InputWidget |
---|---|
Uses Traits | kartik\base\TranslationTrait, kartik\base\WidgetTrait |
Subclasses | kartik\base\Html5Input, kartik\select2\Select2 |
Available since version | 1.0 |
Base input widget class for Krajee extensions
Public Properties
Property | Type | Description | Defined By |
---|---|---|---|
$convertFormat | boolean | Whether the widget should automatically format the date from the PHP DateTime format to the javascript/jquery plugin format | kartik\base\InputWidget |
$data | array | The data (for list inputs) | kartik\base\InputWidget |
$disabled | boolean | Whether input is to be disabled | kartik\base\InputWidget |
$i18n | array | The the internalization configuration for this widget | kartik\base\InputWidget |
$language | string | The language configuration (e.g. 'fr-FR', 'zh-CN'). | kartik\base\InputWidget |
$pluginEvents | array | Widget JQuery events. | kartik\base\InputWidget |
$pluginLoading | mixed | Show loading indicator while plugin loads | kartik\base\InputWidget |
$pluginName | string | The name of the jQuery plugin | kartik\base\InputWidget |
$pluginOptions | array | Widget plugin options | kartik\base\InputWidget |
$readonly | boolean | Whether input is to be readonly | kartik\base\InputWidget |
Protected Properties
Property | Type | Description | Defined By |
---|---|---|---|
$_dataVar | string | The hashed variable to store the pluginOptions | kartik\base\InputWidget |
$_encOptions | string | The Json encoded options | kartik\base\InputWidget |
$_hashVar | string | The hashed variable to store the pluginOptions | kartik\base\InputWidget |
$_lang | string | The two or three letter lowercase code for the language according to ISO-639 | kartik\base\InputWidget |
$_langFile | string | The language js file | kartik\base\InputWidget |
$_loadIndicator | string | The indicator for loading | kartik\base\InputWidget |
$_msgCat | string | Translation message file category name for i18n | kartik\base\InputWidget |
Public Methods
Method | Description | Defined By |
---|---|---|
init() | kartik\base\InputWidget | |
initI18N() | Yii i18n messages configuration for generating translations | kartik\base\TranslationTrait |
Protected Methods
Method | Description | Defined By |
---|---|---|
addAsset() | Adds an asset to the view | kartik\base\WidgetTrait |
convertDateFormat() | Automatically convert the date format from PHP DateTime to Javascript DateTime format | kartik\base\InputWidget |
getInput() | Generates an input | kartik\base\InputWidget |
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 |
initDisability() | Validates and sets disabled or readonly inputs | kartik\base\InputWidget |
initLanguage() | Initialize the plugin language | kartik\base\InputWidget |
parseDateFormat() | Parses date format based on attribute type using yii\helpers\FormatConverter Used only within DatePicker and DateTimePicker. | kartik\base\InputWidget |
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 |
setLanguage() | Sets the language JS file if it exists | kartik\base\InputWidget |
Constants
Constant | Value | Description | Defined By |
---|---|---|---|
LOAD_PROGRESS | ' |
kartik\base\InputWidget |
Property Details
The hashed variable to store the pluginOptions
The Json encoded options
The hashed variable to store the pluginOptions
The two or three letter lowercase code for the language according to ISO-639
The language js file
The indicator for loading
Translation message file category name for i18n
Whether the widget should automatically format the date from the PHP DateTime format to the javascript/jquery plugin format
The data (for list inputs)
Whether input is to be disabled
The the internalization configuration for this widget
The language configuration (e.g. 'fr-FR', 'zh-CN'). The format for the language/locale is ll-CC where ll is a two or three letter lowercase code for a language according to ISO-639 and CC is the country code according to ISO-3166. If this property not set, then the current application language will be used.
Widget JQuery events. You must define events in event-name => event-function format for example: ~~~ pluginEvents = [
"change" => "function() { log("change"); }",
"open" => "function() { log("open"); }",
]; ~~~
Show loading indicator while plugin loads
The name of the jQuery plugin
Widget plugin options
Whether input is to be readonly
Method Details
Automatically convert the date format from PHP DateTime to Javascript DateTime format
See also:
protected static string convertDateFormat ( $format ) | ||
$format | string | The PHP date format string |
Generates an input
protected void getInput ( $type, $list = false ) | ||
$type | ||
$list |
public void init ( ) |
Validates and sets disabled or readonly inputs
protected void initDisability ( <b>&</b>$options ) | ||
$options | array | The HTML attributes for the input |
Initialize the plugin language
protected void initLanguage ( $property = 'language', $full = false ) | ||
$property | string | The name of language property in $pluginOptions. |
$full | boolean | Whether to use the full language string. Defaults to |
Parses date format based on attribute type using yii\helpers\FormatConverter Used only within DatePicker and DateTimePicker.
protected mixed|string parseDateFormat ( $type ) | ||
$type | string | The attribute type whether date, datetime, or time |
throws | \kartik\base\InvalidConfigException |
---|
Sets the language JS file if it exists
protected void setLanguage ( $prefix, $assetPath = null, $filePath = null, $suffix = '.js' ) | ||
$prefix | ||
$assetPath | string | The path to the assets |
$filePath | string | The path to the JS file with the file name prefix |
$suffix | string | The file name suffix - defaults to '.js' |