Class kartik\form\ActiveField

Inheritancekartik\form\ActiveField » yii\widgets\ActiveField
Available since version1.0

Extends the ActiveField component to handle various bootstrap form types and handle input groups.

Example(s): `php echo $this->form->field($model, 'email', ['addon' => ['type'=>'prepend', 'content'=>'@']]); echo $this->form->field($model, 'amount_paid', ['addon' => ['type'=>'append', 'content'=>'.00']]); echo $this->form->field($model, 'phone', ['addon' => ['type'=>'prepend', 'content'=>'<i class="glyphicon

glyphicon-phone']]);

Public Properties

Hide inherited properties

PropertyTypeDescriptionDefined By
$addClass string CSS classname to add to the input kartik\form\ActiveField
$addon array Addon options for text and password inputs. kartik\form\ActiveField
$autoPlaceholder boolean Whether the label is to be hidden and auto-displayed as a placeholder kartik\form\ActiveField
$contentAfterError string Content to be placed after error block kartik\form\ActiveField
$contentAfterHint string Content to be placed after hint block kartik\form\ActiveField
$contentAfterInput string Content to be placed after input kartik\form\ActiveField
$contentAfterLabel string Content to be placed after label kartik\form\ActiveField
$contentBeforeError string Content to be placed before error block kartik\form\ActiveField
$contentBeforeHint string Content to be placed before hint block kartik\form\ActiveField
$contentBeforeInput string Content to be placed before input kartik\form\ActiveField
$contentBeforeLabel string Content to be placed before label kartik\form\ActiveField
$feedbackIcon array The feedback icon configuration (applicable for bootstrap text inputs). kartik\form\ActiveField
$hintSettings array The settings for displaying the hint. kartik\form\ActiveField
$hintType int The hint display type. kartik\form\ActiveField
$showErrors boolean Whether to show errors for the field kartik\form\ActiveField
$showHints boolean Whether to show hints for the field kartik\form\ActiveField
$showLabels boolean|string Whether to show labels for the field. kartik\form\ActiveField
$skipFormLayout boolean Whether to override the form layout styles and skip field formatting as per the form layout. kartik\form\ActiveField
$staticValue string The static value for the field to be displayed for the static input OR when the form is in staticOnly mode. kartik\form\ActiveField

Protected Properties

Hide inherited properties

PropertyTypeDescriptionDefined By
$_hasFeedback bool Whether there is a feedback icon configuration set kartik\form\ActiveField
$_isHintSpecial bool Whether there is a feedback icon configuration set kartik\form\ActiveField
$_isStatic boolean Is it a static input kartik\form\ActiveField
$_multiselect boolean The container for multi select kartik\form\ActiveField
$_offset boolean Whether the input is to be offset (like for checkbox or radio). kartik\form\ActiveField
$_settings array The settings for the active field layout kartik\form\ActiveField

Public Methods

Hide inherited methods

MethodDescriptionDefined By
begin() kartik\form\ActiveField
checkbox() Renders a checkbox. This method will generate the "checked" tag attribute according to the model attribute value. kartik\form\ActiveField
checkboxButtonGroup() Renders a list of checkbox toggle buttons. kartik\form\ActiveField
checkboxList() Renders a list of checkboxes. A checkbox list allows multiple selection, like listBox(). As a result, the corresponding submitted value is an array. The selection of the checkbox list is taken from the value of the model attribute. kartik\form\ActiveField
getAddonContent() Parses and returns addon content kartik\form\ActiveField
hint() kartik\form\ActiveField
init() kartik\form\ActiveField
input() kartik\form\ActiveField
label() kartik\form\ActiveField
listBox() kartik\form\ActiveField
multiselect() Renders a multi select list box. This control extends the checkboxList and radioList available in yii\widgets\ActiveField - to display a scrolling multi select list box. kartik\form\ActiveField
passwordInput() kartik\form\ActiveField
radio() Renders a radio button. This method will generate the "checked" tag attribute according to the model attribute value. kartik\form\ActiveField
radioButtonGroup() Renders a list of radio toggle buttons. kartik\form\ActiveField
radioList() Renders a list of radio buttons. A radio button list is like a checkbox list, except that it only allows single selection. The selection of the radio buttons is taken from the value of the model attribute. kartik\form\ActiveField
render() kartik\form\ActiveField
staticInput() Renders a static input (display only). kartik\form\ActiveField
textInput() kartik\form\ActiveField
textarea() kartik\form\ActiveField
widget() kartik\form\ActiveField

Protected Methods

Hide inherited methods

MethodDescriptionDefined By
buildLayoutParts() Builds the field layout parts kartik\form\ActiveField
buildTemplate() Builds the final template based on the bootstrap form type, display settings for label, error, and hint, and content before and after label, input, error, and hint kartik\form\ActiveField
generateAddon() Generates the addon markup kartik\form\ActiveField
generateHint() Generates the hint. kartik\form\ActiveField
getConfigParam() Gets configuration parameter from formConfig kartik\form\ActiveField
getFeedbackIcon() Generates a feedback icon kartik\form\ActiveField
getHintData() Gets a hint configuration setting value kartik\form\ActiveField
getHintIcon() Generates the hint icon kartik\form\ActiveField
getHintIconCss() Gets the hint icon css based on hintSettings kartik\form\ActiveField
getToggleField() Generates a toggle field (checkbox or radio) kartik\form\ActiveField
getToggleFieldList() Renders a list of checkboxes / radio buttons. The selection of the checkbox / radio buttons is taken from the value of the model attribute. kartik\form\ActiveField
hasLabels() Validate label display status kartik\form\ActiveField
initActiveField() Initialize the active field kartik\form\ActiveField
initDisability() Validates and sets disabled or readonly inputs kartik\form\ActiveField
initHints() Initialize hint settings kartik\form\ActiveField
initLabels() Initialize label options kartik\form\ActiveField
initLayout() Initialize layout settings for label, input, error and hint blocks and for various bootstrap 3 form layouts kartik\form\ActiveField
initPlaceholder() Initializes placeholder based on $autoPlaceholder kartik\form\ActiveField
mergeSettings() Merges the parameters for layout settings kartik\form\ActiveField
renderFeedbackIcon() Renders the bootstrap feedback icon. kartik\form\ActiveField
setHintData() Sets a hint property setting as a data attribute within self::$options kartik\form\ActiveField
setLayoutContainer() Sets the layout element container kartik\form\ActiveField

Constants

Hide inherited constants

ConstantValueDescriptionDefined By
HINT_DEFAULT 1 kartik\form\ActiveField
HINT_SPECIAL 2 kartik\form\ActiveField
MULTI_SELECT_HEIGHT '145px' kartik\form\ActiveField
STYLE_INLINE 'inline' kartik\form\ActiveField
TYPE_CHECKBOX 'checkbox' kartik\form\ActiveField
TYPE_RADIO 'radio' kartik\form\ActiveField

Property Details

$_hasFeedback protected property

Whether there is a feedback icon configuration set

protected bool $_hasFeedback false
$_isHintSpecial protected property

Whether there is a feedback icon configuration set

protected bool $_isHintSpecial false
$_isStatic protected property

Is it a static input

protected boolean $_isStatic false
$_multiselect protected property

The container for multi select

protected boolean $_multiselect ''
$_offset protected property

Whether the input is to be offset (like for checkbox or radio).

protected boolean $_offset false
$_settings protected property

The settings for the active field layout

protected array $_settings = ['input' => '{input}''error' => '{error}''hint' => '{hint}''showLabels' => true'showErrors' => true]
$addClass public property

CSS classname to add to the input

public string $addClass 'form-control'
$addon public property

Addon options for text and password inputs. The following settings can be configured:

  • prepend: array the prepend addon configuration
  • content: string the prepend addon content
  • asButton: boolean whether the addon is a button or button group. Defaults to false.
  • options: array the HTML attributes to be added to the container.
  • append: array the append addon configuration
  • content: string/array the append addon content
  • asButton: boolean whether the addon is a button or button group. Defaults to false.
  • options: array the HTML attributes to be added to the container.
  • groupOptions: array HTML options for the input group
  • contentBefore: string content placed before addon
  • contentAfter: string content placed after addon
public array $addon = []
$autoPlaceholder public property

Whether the label is to be hidden and auto-displayed as a placeholder

public boolean $autoPlaceholder null
$contentAfterError public property

Content to be placed after error block

$contentAfterHint public property

Content to be placed after hint block

$contentAfterInput public property

Content to be placed after input

$contentAfterLabel public property

Content to be placed after label

$contentBeforeError public property

Content to be placed before error block

$contentBeforeHint public property

Content to be placed before hint block

$contentBeforeInput public property

Content to be placed before input

$contentBeforeLabel public property

Content to be placed before label

$feedbackIcon public property

The feedback icon configuration (applicable for bootstrap text inputs).

See also http://getbootstrap.com/css/#with-optional-icons This must be setup as an array containing the following keys: - type: string, the icon type to use. Should be one of raw or icon. Defaults to icon, where the default, error and success settings will be treated as an icon CSS suffix name. If set to raw, they will be treated as a raw content markup. - prefix: string, the icon CSS class prefix to use if type is icon. Defaults to glyphicon glyphicon-. - default: string, the icon (CSS class suffix name or raw markup) to show by default. If not set will not be shown. - error: string, the icon (CSS class suffix name or raw markup) to use when input has an error validation. If not set will not be shown. - success: string, the icon (CSS class suffix name or raw markup) to use when input has a success validation. If not set will not be shown. - defaultOptions: array, the HTML attributes to apply for default icon. The special attribute description can be set to describe this feedback as an aria attribute for accessibility. Defaults to (default). - errorOptions: array, the HTML attributes to apply for error icon. The special attribute description can be set to describe this feedback as an aria attribute for accessibility. Defaults to (error). - successOptions: array, the HTML attributes to apply for success icon. The special attribute description can be set to describe this feedback as an aria attribute for accessibility. Defaults to (success).

public array $feedbackIcon = []
$hintSettings public property

The settings for displaying the hint. These settings are parsed only if hintType is set to

`self::HINT_SPECIAL`. The following properties are supported:
  • showIcon: bool, whether to display the hint via a help icon indicator. Defaults to true.
  • icon: string, the markup to display the help icon. Defaults to <i class="glyphicon glyphicon-question-sign text-info"></i>.
  • iconBesideInput: bool, whether to display the icon beside the input. Defaults to false. The following actions will be taken based on this setting:
    • if set to false the help icon is displayed beside the label and the labelTemplate setting is used to render the icon and label markups.
    • if set to true the help icon is displayed beside the input and the inputTemplate setting is used to render the icon and input markups.
  • labelTemplate: string, the template to render the help icon and the field label. Defaults to {label}{help}, where
    • {label} will be replaced by the ActiveField label content
    • {help} will be replaced by the help icon indicator markup
  • inputTemplate: string, the template to render the help icon and the field input. Defaults to <table style="width:100%"><tr><td>{input}</td><td style="width:5%">{help}</td></tr></table>, where
    • {input} will be replaced by the ActiveField input content
    • {help} will be replaced by the help icon indicator markup
  • onLabelClick: bool, whether to display the hint on clicking the label. Defaults to false.
  • onLabelHover: bool, whether to display the hint on hover of the label. Defaults to true.
  • onIconClick: bool, whether to display the hint on clicking the icon. Defaults to true.
  • onIconHover: bool, whether to display the hint on hover of the icon. Defaults to false.
  • iconCssClass: string, the CSS class appended to the span container enclosing the icon.
  • labelCssClass: string, the CSS class appended to the span container enclosing label text within label tag.
  • contentCssClass: string, the CSS class appended to the span container displaying help content within popover.
  • hideOnEscape: bool, whether to hide the popover on clicking escape button on the keyboard. Defaults to true.
  • hideOnClickOut: bool, whether to hide the popover on clicking outside the popover. Defaults to true.
  • title: string, the title heading for the popover dialog. Defaults to empty string, whereby the heading is not displayed.
  • placement: string, the placement of the help popover on hover or click of the icon or label. Defaults to top.
  • container: string, the specific element to which the popover will be appended to. Defaults to table when iconBesideInput is true, else defaults to form
  • animation: bool, whether to add a CSS fade transition effect when opening and closing the popover. Defaults to true.
  • delay: int|array, the number of milliseconds it will take to open and close the popover. Defaults to 0.
  • selector: int, the specified selector to add the popover to. Defaults to boolean false.
  • viewport: string|array, the element within which the popover will be bounded to. Defaults to ['selector' => 'body', 'padding' => 0].
public array $hintSettings = []
$hintType public property

The hint display type. If set to self::HINT_DEFAULT, the hint will be displayed as a text block below

each input. If set to `self::HINT_SPECIAL`, then the `hintSettings` will be applied to display the field
hint.
public int $hintType self::HINT_DEFAULT
$showErrors public property

Whether to show errors for the field

public boolean $showErrors null
$showHints public property

Whether to show hints for the field

public boolean $showHints null
$showLabels public property

Whether to show labels for the field. Should be one of the following values:

  • true: show labels for the field
  • false: hide labels for the field
  • ActiveForm::SCREEN_READER: show in screen reader only (hide from normal display)
public boolean|string $showLabels null
$skipFormLayout public property

Whether to override the form layout styles and skip field formatting as per the form layout.

Defaults to `false`.
public boolean $skipFormLayout false
$staticValue public property

The static value for the field to be displayed for the static input OR when the form is in

staticOnly mode. This value is not HTML encoded.
public string $staticValue null

Method Details

begin() public method

public void begin ( )
buildLayoutParts() protected method

Builds the field layout parts

protected void buildLayoutParts ( $showLabels, $showErrors )
$showLabels bool

Whether to show labels

$showErrors bool

Whether to show errors

buildTemplate() protected method

Builds the final template based on the bootstrap form type, display settings for label, error, and hint, and content before and after label, input, error, and hint

protected void buildTemplate ( )
checkbox() public method

Renders a checkbox. This method will generate the "checked" tag attribute according to the model attribute value.

public kartik\form\ActiveField checkbox ( $options = [], $enclosedByLabel true )
$options array

The tag options in terms of name-value pairs. The following options are specially handled:

  • uncheck: string, the value associated with the uncheck state of the checkbox. If not set, it will take the default value '0'. This method will render a hidden input so that if the checkbox is not checked and is submitted, the value of this attribute will still be submitted to the server via the hidden input.
  • label: string, a label displayed next to the checkbox. It will NOT be HTML-encoded. Therefore you can pass in HTML code such as an image tag. If this is is coming from end users, you should \yii\helpers\Html::encode() it to prevent XSS attacks. When this option is specified, the checkbox will be enclosed by a label tag.
  • labelOptions: array, the HTML attributes for the label tag. This is only used when the "label" option is specified.
  • container: boolean|array, the HTML attributes for the checkbox container. If this is set to false, no container will be rendered. The special option tag will be recognized which defaults to div. This defaults to: ['tag' => 'div', 'class'=>'radio'] The rest of the options will be rendered as the attributes of the resulting tag. The values will be HTML-encoded using \yii\helpers\Html::encode(). If a value is null, the corresponding attribute will not be rendered.
$enclosedByLabel boolean

Whether to enclose the radio within the label. If true, the method will still use \kartik\form\template to layout the checkbox and the error message except that the radio is enclosed by the label tag.

return kartik\form\ActiveField

Object

checkboxButtonGroup() public method

Renders a list of checkbox toggle buttons.

See also http://getbootstrap.com/javascript/#buttons-checkbox-radio.

public kartik\form\ActiveField checkboxButtonGroup ( $items, $options = [] )
$items array

The data item used to generate the checkboxes. The array values are the labels, while the

array keys are the corresponding checkbox values. Note that the labels will NOT be HTML-encoded, while the
values will.
$options array

Options (name => config) for the checkbox button list. The following options are specially

handled:
  • unselect: string, the value that should be submitted when none of the checkboxes is selected. By setting this option, a hidden input will be generated. If you do not want any hidden input, you should explicitly set this option as null.
  • separator: string, the HTML code that separates items.
  • item: callable, a callback that can be used to customize the generation of the HTML code corresponding to a single item in $items. The signature of this callback must be:
function ($index, $label, $name, $checked, $value)

where $index is the zero-based index of the checkbox button in the whole list; $label is the label for the

checkbox button; and $name, $value and $checked represent the name, value and the checked status of the
checkbox button input.
return kartik\form\ActiveField

Object

checkboxList() public method

Renders a list of checkboxes. A checkbox list allows multiple selection, like listBox(). As a result, the corresponding submitted value is an array. The selection of the checkbox list is taken from the value of the model attribute.

public kartik\form\ActiveField checkboxList ( $items, $options = [] )
$items array

The data item used to generate the checkboxes. The array values are the labels, while the

array keys are the corresponding checkbox values. Note that the labels will NOT be HTML-encoded, while the
values will be encoded.
$options array

Options (name => config) for the checkbox list. The following options are specially

handled:
  • unselect: string, the value that should be submitted when none of the checkboxes is selected. By setting this option, a hidden input will be generated.
  • separator: string, the HTML code that separates items.
  • inline: boolean, whether the list should be displayed as a series on the same line, default is false
  • item: callable, a callback that can be used to customize the generation of the HTML code corresponding to a single item in $items. The signature of this callback must be:
    function ($index, $label, $name, $checked, $value)
    

where $index is the zero-based index of the checkbox in the whole list; $label is the label for the checkbox;

and $name, $value and $checked represent the name, value and the checked status of the checkbox input.
return kartik\form\ActiveField

Object

public void dropDownList ( $items, $options = [] )
$items
$options
generateAddon() protected method

Generates the addon markup

protected string generateAddon ( )
generateHint() protected method

Generates the hint.

protected string generateHint ( $content null )
$content string

The hint content

getAddonContent() public static method

Parses and returns addon content

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

The addon parameter

getConfigParam() protected method

Gets configuration parameter from formConfig

protected bool getConfigParam ( $param, $default true )
$param string

The parameter name

$default mixed

The default parameter value

return bool

The parsed parameter value

getFeedbackIcon() protected method

Generates a feedback icon

protected string getFeedbackIcon ( $config, $cat, $type, $prefix, $id )
$config array

The feedback icon configuration

$cat string

The feedback icon category

$type string

The feedback icon type

$prefix string

The feedback icon prefix

$id string

The input attribute identifier

getHintData() protected method

Gets a hint configuration setting value

protected mixed getHintData ( $key, $default null )
$key string

The hint setting key to fetch

$default mixed

The default value if not set

getHintIcon() protected method

Generates the hint icon

protected string getHintIcon ( )
getHintIconCss() protected method

Gets the hint icon css based on hintSettings

protected array getHintIconCss ( $type )
$type string

Whether Label or Icon

return array

The css to be applied

getToggleField() protected method

Generates a toggle field (checkbox or radio)

protected kartik\form\ActiveField getToggleField ( $type self::TYPE_CHECKBOX, $options = [], $enclosedByLabel true )
$type string

The toggle input type 'checkbox' or 'radio'.

$options array

Options (name => config) for the toggle input list container tag.

$enclosedByLabel bool

Whether the input is enclosed by the label tag

return kartik\form\ActiveField

Object

getToggleFieldList() protected method

Renders a list of checkboxes / radio buttons. The selection of the checkbox / radio buttons is taken from the value of the model attribute.

protected kartik\form\ActiveField getToggleFieldList ( $type, $items, $options = [], $asButtonGroup false )
$type string

The toggle input type 'checkbox' or 'radio'.

$items array

The data item used to generate the checkbox / radio buttons. The array keys are the labels,

while the array values are the corresponding checkbox / radio button values. Note that the labels will NOT
be HTML-encoded, while the values will be encoded.
$options array

Options (name => config) for the checkbox / radio button list. The following options are

specially handled:
  • unselect: string, the value that should be submitted when none of the checkbox / radio buttons is selected. By setting this option, a hidden input will be generated.
  • separator: string, the HTML code that separates items.
  • inline: boolean, whether the list should be displayed as a series on the same line, default is false
  • disabledItems: array, the list of values that will be disabled.
  • readonlyItems: array, the list of values that will be readonly.
  • item: callable, a callback that can be used to customize the generation of the HTML code corresponding to a single item in $items. The signature of this callback must be:
function ($index, $label, $name, $checked, $value)

where $index is the zero-based index of the checkbox/ radio button in the whole list; $label is the label for

the checkbox/ radio button; and $name, $value and $checked represent the name, value and the checked status
of the checkbox/ radio button input.
$asButtonGroup bool

Whether to generate the toggle list as a bootstrap button group

return kartik\form\ActiveField

Object

hasLabels() protected method

Validate label display status

protected bool|string hasLabels ( )
return bool|string

Whether labels are to be shown

hint() public method

public void hint ( $content, $options = [] )
$content
$options
init() public method

public void init ( )
initActiveField() protected method

Initialize the active field

protected void initActiveField ( )
initDisability() protected method

Validates and sets disabled or readonly inputs

protected void initDisability ( &$options )
$options array

The HTML attributes for the input

initHints() protected method

Initialize hint settings

protected void initHints ( )
initLabels() protected method

Initialize label options

protected void initLabels ( )
initLayout() protected method

Initialize layout settings for label, input, error and hint blocks and for various bootstrap 3 form layouts

protected void initLayout ( )
initPlaceholder() protected method

Initializes placeholder based on $autoPlaceholder

protected void initPlaceholder ( &$options )
$options array

The HTML attributes for the input

input() public method

public void input ( $type, $options = [] )
$type
$options
label() public method

public void label ( $label null, $options = [] )
$label
$options
listBox() public method

public void listBox ( $items, $options = [] )
$items
$options
mergeSettings() protected method

Merges the parameters for layout settings

protected void mergeSettings ( $showLabels, $showErrors )
$showLabels bool

Whether to show labels

$showErrors bool

Whether to show errors

multiselect() public method

Renders a multi select list box. This control extends the checkboxList and radioList available in yii\widgets\ActiveField - to display a scrolling multi select list box.

public kartik\form\ActiveField multiselect ( $items, $options = [] )
$items array

The data item used to generate the checkboxes or radio.

$options array

The options for checkboxList or radioList. Additional parameters

  • height: string, the height of the multiselect control - defaults to 145px
  • selector: string, whether checkbox or radio - defaults to checkbox
  • container: array, options for the multiselect container
  • unselect: string, the value that should be submitted when none of the radio buttons is selected. By setting this option, a hidden input will be generated.
  • separator: string, the HTML code that separates items.
  • item: callable, a callback that can be used to customize the generation of the HTML code corresponding to a single item in $items. The signature of this callback must be:
  • inline: boolean, whether the list should be displayed as a series on the same line, default is false
  • selector: string, whether the selection input is self::TYPE_RADIO or self::TYPE_CHECKBOX
return kartik\form\ActiveField

Object

passwordInput() public method

public void passwordInput ( $options = [] )
$options
radio() public method

Renders a radio button. This method will generate the "checked" tag attribute according to the model attribute value.

public kartik\form\ActiveField radio ( $options = [], $enclosedByLabel true )
$options array

The tag options in terms of name-value pairs. The following options are specially

handled:
  • uncheck: string, the value associated with the uncheck state of the radio button. If not set, it will take the default value '0'. This method will render a hidden input so that if the radio button is not checked and is submitted, the value of this attribute will still be submitted to the server via the hidden input.
  • label: string, a label displayed next to the radio button. It will NOT be HTML-encoded. Therefore you can pass in HTML code such as an image tag. If this is is coming from end users, you should \yii\helpers\Html::encode() it to prevent XSS attacks. When this option is specified, the radio button will be enclosed by a label tag.
  • labelOptions: array, the HTML attributes for the label tag. This is only used when the "label" option is specified.
  • container: boolean|array, the HTML attributes for the checkbox container. If this is set to false, no container will be rendered. The special option tag will be recognized which defaults to div. This defaults to: ['tag' => 'div', 'class'=>'radio'] The rest of the options will be rendered as the attributes of the resulting tag. The values will be HTML-encoded using \yii\helpers\Html::encode(). If a value is null, the corresponding attribute will not be rendered.
$enclosedByLabel boolean

Whether to enclose the radio within the label. If true, the method will still

use [[template]] to layout the checkbox and the error message except that the radio is enclosed by the label
tag.
return kartik\form\ActiveField

Object

radioButtonGroup() public method

Renders a list of radio toggle buttons.

See also http://getbootstrap.com/javascript/#buttons-checkbox-radio.

public kartik\form\ActiveField radioButtonGroup ( $items, $options = [] )
$items array

The data item used to generate the radios. The array values are the labels, while the array

keys are the corresponding radio values. Note that the labels will NOT be HTML-encoded, while the values
will be encoded.
$options array

Options (name => config) for the radio button list. The following options are specially

handled:
  • unselect: string, the value that should be submitted when none of the radios is selected. By setting this option, a hidden input will be generated. If you do not want any hidden input, you should explicitly set this option as null.
  • separator: string, the HTML code that separates items.
  • item: callable, a callback that can be used to customize the generation of the HTML code corresponding to a single item in $items. The signature of this callback must be:
function ($index, $label, $name, $checked, $value)

where $index is the zero-based index of the radio button in the whole list; $label is the label for the radio

button; and $name, $value and $checked represent the name, value and the checked status of the radio button
input.
return kartik\form\ActiveField

Object

radioList() public method

Renders a list of radio buttons. A radio button list is like a checkbox list, except that it only allows single selection. The selection of the radio buttons is taken from the value of the model attribute.

public kartik\form\ActiveField radioList ( $items, $options = [] )
$items array

The data item used to generate the radio buttons. The array keys are the labels, while the

array values are the corresponding radio button values. Note that the labels will NOT be HTML-encoded, while
the values will.
$options array

Options (name => config) for the radio button list. The following options are specially handled:

  • unselect: string, the value that should be submitted when none of the radio buttons is selected. By setting this option, a hidden input will be generated.
  • separator: string, the HTML code that separates items.
  • inline: boolean, whether the list should be displayed as a series on the same line, default is false
  • item: callable, a callback that can be used to customize the generation of the HTML code corresponding to a single item in $items. The signature of this callback must be:
function ($index, $label, $name, $checked, $value)

where $index is the zero-based index of the radio button in the whole list; $label is the label for the radio

button; and $name, $value and $checked represent the name, value and the checked status of the radio button
input.
return kartik\form\ActiveField

Object

render() public method

public void render ( $content null )
$content
renderFeedbackIcon() protected method

Renders the bootstrap feedback icon.

See also http://getbootstrap.com/css/#with-optional-icons.

protected string renderFeedbackIcon ( )
setHintData() protected method

Sets a hint property setting as a data attribute within self::$options

protected void setHintData ( $key )
$key string

The hint property key

setLayoutContainer() protected method

Sets the layout element container

protected void setLayoutContainer ( $type, $css '', $chk true )
$type string

The layout element type

$css string

The css class for the container

$chk bool

Whether to create the container for the layout element

staticInput() public method

Renders a static input (display only).

public kartik\form\ActiveField staticInput ( $options = [] )
$options array

The tag options in terms of name-value pairs.

return kartik\form\ActiveField

Object

textInput() public method

public void textInput ( $options = [] )
$options
textarea() public method

public void textarea ( $options = [] )
$options
widget() public method

public void widget ( $class, $config = [] )
$class
$config