TbHtml::activeCheckBox PHP Method

activeCheckBox() public static method

Generates a check box for a model attribute.
public static activeCheckBox ( CModel $model, string $attribute, array $htmlOptions = [] ) : string
$model CModel the data model.
$attribute string the attribute.
$htmlOptions array additional HTML attributes.
return string the generated check box.
    public static function activeCheckBox($model, $attribute, $htmlOptions = array())
    {
        $label = TbArray::popValue('label', $htmlOptions, false);
        $labelOptions = TbArray::popValue('labelOptions', $htmlOptions, array());
        $input = parent::activeCheckBox($model, $attribute, $htmlOptions);
        if (TbArray::popValue('useContainer', $htmlOptions, false)) {
            return self::tag('div', array('class' => 'checkbox'), self::createCheckBoxAndRadioButtonLabel($label, $input, $labelOptions));
        } else {
            return self::createCheckBoxAndRadioButtonLabel($label, $input, $labelOptions);
        }
    }

Usage Example

Example #1
0
	</div><br/>
	
	<div style="width: 45%;">
		<p class="hint">
		<?php 
echo TbHtml::link(UserModule::t("Register"), Yii::app()->getModule('user')->registrationUrl);
?>
<br/><?php 
echo TbHtml::link(UserModule::t("Lost Password?"), Yii::app()->getModule('user')->recoveryUrl);
?>
		</p>
	</div>
	<!--
	<div class="row-fluid rememberMe">
		<?php 
echo TbHtml::activeCheckBox($model, 'rememberMe');
?>
		<?php 
echo TbHtml::activeLabelEx($model, 'rememberMe');
?>
	</div> -->

	<div class="row-fluid submit">
		<?php 
echo TbHtml::submitButton(UserModule::t("Login"), array('color' => TbHtml::BUTTON_COLOR_PRIMARY, 'submit' => ''));
?>
	</div>
	
<?php 
echo TbHtml::endForm();
?>
All Usage Examples Of TbHtml::activeCheckBox
TbHtml