helpers\BaseHtml booleanInput()

booleanInput() protected static method (available since version 2.0.9)

Generates a boolean input.

protected static string booleanInput ( $type, $name, $checked = false, $options = [] )
$type string

The input type. This can be either radio or checkbox.

$name string

The name attribute.

$checked boolean

Whether the checkbox should be checked.

$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. When this attribute is present, a hidden input will be generated 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 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. Do not set this option unless you set the "label" option.

The rest of the options will be rendered as the attributes of the resulting checkbox tag. The values will be HTML-encoded using encode(). If a value is null, the corresponding attribute will not be rendered. See renderTagAttributes() for details on how attributes are being rendered.

return string

The generated checkbox tag

doc_Yii
2016-10-30 17:04:59
Comments
Leave a Comment

Please login to continue.