Class kartik\base\Html5Input

Inheritancekartik\base\Html5Input » kartik\base\InputWidget » yii\widgets\InputWidget
Uses Traitskartik\base\TranslationTrait, kartik\base\WidgetTrait
Available since version1.0

Html5Input widget is a widget encapsulating the HTML 5 inputs.

See also http://twitter.github.com/typeahead.js/examples.

Public Properties

Hide inherited properties

PropertyTypeDescriptionDefined By
$addon array The addon content configuration. kartik\base\Html5Input
$containerOptions array The HTML attributes for the widget container kartik\base\Html5Input
$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
$enablePopStateFix boolean Enable pop state fix for pjax container on press of browser back & forward buttons. kartik\base\InputWidget
$html5Container array The HTML attributes for the HTML-5 input container kartik\base\Html5Input
$html5Options array The HTML attributes for the HTML-5 input. kartik\base\Html5Input
$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
$noSupport string|boolean The message shown for unsupported browser. kartik\base\Html5Input
$noSupportOptions string Array the HTML attributes for container displaying unsupported browser message kartik\base\Html5Input
$pjaxContainerId string A pjax container identifier if applicable inside which the widget will be rendered. kartik\base\InputWidget
$pluginDestroyJs string The javascript that will be used to destroy the jQuery plugin kartik\base\InputWidget
$pluginEvents array Widget JQuery events. kartik\base\InputWidget
$pluginLoading boolean 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
$size string One of the SIZE modifiers 'lg', 'md', 'sm', 'xs' kartik\base\Html5Input
$type string The HTML 5 input type kartik\base\Html5Input
$width string The width in 'px' or '%' of the HTML5 input container kartik\base\Html5Input

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\InputWidget
$_encOptions string The JSON encoded plugin options. kartik\base\InputWidget
$_hashVar string The generated hashed variable name that will store the JSON encoded pluginOptions in \kartik\base\View::POS_HEAD. 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 to be displayed while plugin is loading. kartik\base\InputWidget
$_msgCat string Translation message file category name for i18n. kartik\base\InputWidget

Public Methods

Hide inherited methods

MethodDescriptionDefined By
init() kartik\base\InputWidget
initI18N() Yii i18n messages configuration for generating translations kartik\base\TranslationTrait
registerAssets() Registers the needed assets for kartik\base\Html5Input widget. kartik\base\Html5Input
registerWidgetJs() Registers a JS code block for the widget. kartik\base\WidgetTrait
run() kartik\base\Html5Input

Protected Methods

Hide inherited methods

MethodDescriptionDefined 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
getAddonContent() Parses and returns addon content. kartik\base\Html5Input
getHtml5Input() Gets the HTML5 input. kartik\base\Html5Input
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 : kartik\base\WidgetTrait
initDestroyJs() Generates the pluginDestroyJs script if it is not set. kartik\base\WidgetTrait
initDisability() Validates and sets disabled or readonly inputs. kartik\base\InputWidget
initInput() Initializes the input. kartik\base\Html5Input
initInputWidget() Initializes the input widget. kartik\base\InputWidget
initLanguage() Initialize the plugin language. kartik\base\InputWidget
parseDateFormat() Parses and sets plugin date format based on attribute type using \yii\helpers\FormatConverter. Currently this method is used only within the \kartik\date\DatePicker and \kartik\datetime\DateTimePicker\ widgets. kartik\base\InputWidget
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
renderInput() Renders the special HTML5 input. Mainly useful for the color and range inputs kartik\base\Html5Input
setDataVar() Sets a HTML5 data variable. kartik\base\WidgetTrait
setLanguage() Sets the language JS file if it exists. kartik\base\InputWidget

Constants

Hide inherited constants

ConstantValueDescriptionDefined By
LOAD_PROGRESS '
 
'
kartik\base\InputWidget

Property Details

$addon public property

The addon content configuration. The following array keys can be configured:

  • prepend : _array|string, the prepend addon content. If set as a string, will be rendered raw as is without HTML encoding. If set as an array, the following options can be set:
    • content : string, the prepend addon content
    • asButton : boolean, whether the addon is a button
    • options : _array the HTML attributes for the prepend addon
  • append : array|string, the append addon content.If set as a string, will be rendered raw as is without HTML encoding. If set as an array, the following options can be set:
    • content : string, the append addon content
    • asButton : boolean, whether the addon is a button
    • options : _array the HTML attributes for the append addon
  • preCaption : array|string, the addon content placed before the caption.If set as a string, will be rendered raw as is without HTML encoding. If set as an array, the following options can be set:
    • content : string, the append addon content
    • asButton : boolean, whether the addon is a button
    • options : _array the HTML attributes for the append addon
public array $addon = []
$containerOptions public property

The HTML attributes for the widget container

$html5Container public property

The HTML attributes for the HTML-5 input container

public array $html5Container = []
$html5Options public property

The HTML attributes for the HTML-5 input.

public array $html5Options = []
$noSupport public property

The message shown for unsupported browser. If set to false will not be displayed

public string|boolean $noSupport null
$noSupportOptions public property

Array the HTML attributes for container displaying unsupported browser message

$size public property

One of the SIZE modifiers 'lg', 'md', 'sm', 'xs'

public string $size null
$type public property

The HTML 5 input type

public string $type null
$width public property

The width in 'px' or '%' of the HTML5 input container

public string $width null

Method Details

getAddonContent() protected static method

Parses and returns addon content.

protected static string getAddonContent ( $addon )
$addon string|array

The addon parameter

getHtml5Input() protected method

Gets the HTML5 input.

protected string getHtml5Input ( )
initInput() protected method

Initializes the input.

protected void initInput ( )
registerAssets() public method

Registers the needed assets for kartik\base\Html5Input widget.

public void registerAssets ( )
renderInput() protected method

Renders the special HTML5 input. Mainly useful for the color and range inputs

protected void renderInput ( )
run() public method

public void run ( )