PHP Класс macgyer\yii2materializecss\widgets\form\SwitchButton

Автор: Christoph Erdmann ([email protected])
Наследование: extends macgyer\yii2materializecss\lib\BaseInputWidget
Показать файл Открыть проект

Открытые свойства

Свойство Тип Описание
$attribute the model attribute that this widget is associated with.
$checked the control for setting the "checked" attribute in the input tag.
$encodeOffText whether the off text should be HTML-encoded.
$encodeOnText whether the on text should be HTML-encoded.
$inputOptions the HTML attributes for the underlying input tag.
$model the data model that this widget is associated with.
$name the input name. This must be set if [[model]] and [[attribute]] are not set.
$offIcon the options for the optional off icon. To specify an icon you can use the following parameters: php [ 'name' => 'name of the icon', // required 'position' => 'position of the icon', // optional, 'left' or 'right', defaults to 'left' 'options' => 'the HTML attributes for the img', // optional ]
$offText the text displaying the unchecked status. This can be used in conjunction with the [[offIcon]].
$onIcon the options for the optional on icon. To specify an icon you can use the following parameters: php [ 'name' => 'name of the icon', // required 'position' => 'position of the icon', // optional, 'left' or 'right', defaults to 'left' 'options' => 'the HTML attributes for the img', // optional ]
$onText the text displaying the checked status. This can be used in conjunction with the [[onIcon]].
$options the HTML attributes for the widget container tag. The following special options are recognized: - tag: string, defaults to "div", the name of the container tag.
$uncheck 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. If you do not want any hidden input, you should explicitly set this option as null.
$value the input value. If not set, it will take the default value "1".

Открытые методы

Метод Описание
init ( ) Initialize the widget.
run ( ) : string Executes the widget.

Защищенные методы

Метод Описание
renderIcon ( string $state ) : string Renders an icon.
renderLabel ( string $state ) : string Renders the HTML markup for the on/off label.
renderSwitch ( ) : string Render the switch button checkbox.

Описание методов

init() публичный Метод

Initialize the widget.
public init ( )

renderIcon() защищенный Метод

Renders an icon.
См. также: Icon::run
protected renderIcon ( string $state ) : string
$state string the name of the icon property.
Результат string the rendered icon

renderLabel() защищенный Метод

This method also renders the corresponding icons, if set.
protected renderLabel ( string $state ) : string
$state string the state to used. Use "off" or "on".
Результат string the rendered label.

renderSwitch() защищенный Метод

Render the switch button checkbox.
protected renderSwitch ( ) : string
Результат string

run() публичный Метод

Executes the widget.
public run ( ) : string
Результат string the result of widget execution to be outputted.

Описание свойств

$attribute публичное свойство

the model attribute that this widget is associated with.
public $attribute

$checked публичное свойство

the control for setting the "checked" attribute in the input tag.
public $checked

$encodeOffText публичное свойство

whether the off text should be HTML-encoded.
public $encodeOffText

$encodeOnText публичное свойство

whether the on text should be HTML-encoded.
public $encodeOnText

$inputOptions публичное свойство

the HTML attributes for the underlying input tag.
См. также: [yii\helpers\BaseHtml::renderTagAttributes()](http://www.yiiframework.com/doc-2.0/yii-helpers-basehtml.html#renderTagAttributes()-detail) for details on how attributes are being rendered.
public $inputOptions

$model публичное свойство

the data model that this widget is associated with.
public $model

$name публичное свойство

the input name. This must be set if [[model]] and [[attribute]] are not set.
public $name

$offIcon публичное свойство

the options for the optional off icon. To specify an icon you can use the following parameters: php [ 'name' => 'name of the icon', // required 'position' => 'position of the icon', // optional, 'left' or 'right', defaults to 'left' 'options' => 'the HTML attributes for the img', // optional ]
public $offIcon

$offText публичное свойство

the text displaying the unchecked status. This can be used in conjunction with the [[offIcon]].
public $offText

$onIcon публичное свойство

the options for the optional on icon. To specify an icon you can use the following parameters: php [ 'name' => 'name of the icon', // required 'position' => 'position of the icon', // optional, 'left' or 'right', defaults to 'left' 'options' => 'the HTML attributes for the img', // optional ]
public $onIcon

$onText публичное свойство

the text displaying the checked status. This can be used in conjunction with the [[onIcon]].
public $onText

$options публичное свойство

the HTML attributes for the widget container tag. The following special options are recognized: - tag: string, defaults to "div", the name of the container tag.
См. также: [yii\helpers\BaseHtml::renderTagAttributes()](http://www.yiiframework.com/doc-2.0/yii-helpers-basehtml.html#renderTagAttributes()-detail) for details on how attributes are being rendered.
public $options

$uncheck публичное свойство

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. If you do not want any hidden input, you should explicitly set this option as null.
public $uncheck

$value публичное свойство

the input value. If not set, it will take the default value "1".
public $value