Html Cakephp3:如何将复选框输出为2列?
我通过此调用在视图中输出一组复选框:Html Cakephp3:如何将复选框输出为2列?,html,cakephp,cakephp-3.0,Html,Cakephp,Cakephp 3.0,我通过此调用在视图中输出一组复选框: <?=$this->Form->input('roles._ids', [ 'options' => $roles, 'label' => false, 'multiple' => 'checkbox', 'templates' => [ 'checkboxWrapper' => '<label class="mt-checkbox">{
<?=$this->Form->input('roles._ids', [
'options' => $roles,
'label' => false,
'multiple' => 'checkbox',
'templates' => [
'checkboxWrapper' => '<label class="mt-checkbox">{{label}}<span></span></label>',
'nestingLabel' => '{{input}}{{text}}',
'inputContainer' => '<div class="col-md-1" style="padding-top: 10px;"><div class="mt-checkbox-list" data-error-container="#form_2_services_error">{{content}}</div></div>'
]]);
?>
如果要将复选框分隔为两列,可以这样做
<?php
$this->Form->templates([
'checkboxWrapper' => '<div class="col-md-6">{{label}}</div>'
]);
?>
<?=$this->Form->input('roles._ids', [
'options' => ['asdasd','asdasd','asdasd'],
'label' => false,
'multiple' => 'checkbox',
]);
?>
希望这会有所帮助
<?php
$this->Form->templates([
'checkboxWrapper' => '<div class="col-md-6">{{label}}</div>'
]);
?>
<?=$this->Form->input('roles._ids', [
'options' => ['asdasd','asdasd','asdasd'],
'label' => false,
'multiple' => 'checkbox',
]);
?>
.checkbox {
width: 49%;
display: inline-block;
}