Skip to content

Instantly share code, notes, and snippets.

@Deele
Last active December 3, 2015 11:35
Show Gist options
  • Save Deele/3d15aa0c17c836c106e9 to your computer and use it in GitHub Desktop.
Save Deele/3d15aa0c17c836c106e9 to your computer and use it in GitHub Desktop.
Yii2 Bootstrap ActiveForm horizontal layout checkbox syntax
<?php
use yii\bootstrap\ActiveForm;
use yii\bootstrap\ActiveField;
$activeField = new ActiveField();
?><div class="tour-form">
<?php $form = ActiveForm::begin(); ?>
<div class="form-horizontal">
<?php
echo <<<HTML
{$form->field(
$model,
'is_title_shown',
[
'wrapperOptions' => ['class' => 'col-sm-offset-4 col-sm-8'],
]
)->checkbox([
'template'=> $activeField->horizontalCheckboxTemplate,
])}
HTML
?>
</div>
<?php ActiveForm::end(); ?>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment