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 - prepend: array/string the prepend addon content. 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
$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
$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
$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 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

Hide inherited methods

MethodDescriptionDefined By
init() Runs the widget kartik\base\Html5Input
initI18N() Yii i18n messages configuration for generating translations kartik\base\TranslationTrait
registerAssets() Registers the needed assets 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 return string 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 : - '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
initInput() kartik\base\Html5Input
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
renderInput() Renders the special HTML5 input Mainly useful for the color and range inputs kartik\base\Html5Input
setDataVar() Sets 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

  • prepend: array/string the prepend addon content. 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 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 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
getHtml5Input() protected method

Gets the HTML5 input return string

protected void getHtml5Input ( )
init() public method

Runs the widget

public void init ( )
initInput() protected method

protected void initInput ( )
registerAssets() public method

Registers the needed assets

public void registerAssets ( )
renderInput() protected method

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

protected void renderInput ( )