V2.0-布局示例
yoyocmf 2020-02-22 22:06:12

1、Horizontal Form 

Horizontal Form.png

PHP Code复制内容到剪贴板
  1. <div class="menu-form">  
  2.     <?php $form = ActiveForm::begin([  
  3.         'options' => [  
  4.             'class' => 'form-horizontal'  
  5.         ],  
  6.         'fieldConfig' => [  
  7.             'options' => ['class' => 'form-group row'],  
  8.             'labelOptions' => ['class' => 'col-md-2 col-form-label text-right'],  
  9.             'template' => "{label}\n<div class='col-md-6'>{input}</div>\n{hint}\n{error}",  
  10. //            'inputOptions' => ['class' => 'form-control'],  
  11.             'errorOptions' => ['class' => 'col-md-4 text-danger help-block'],  
  12.         ],  
  13.     ]); ?>  
  14.     <?= Html::activeHiddenInput($model'bclassid', ['classid' => 'bclassid']); ?>  
  15.     <?= Html::activeHiddenInput($model'app_id', ['value' => Yii::$app->id]); ?>  
  16.   
  17.     <div class="card-body">  
  18.         <?= $form->field($model'icon')->widget(\backend\widgets\iconpicker\IconPickerWidget::className()) ?>  
  19.         <?= $form->field($model'classname')->textInput(['maxlength' => 128]) ?>  
  20.   
  21.         <?= $form->field($model'parent_name')->dropDownList(Menu::getDropDownList(\common\helpers\Tree::build($model::find()->asArray()->all(), 'classid''bclassid''children', null)), ['encode' => false, 'prompt' => '请选择''id' => 'parent_name'])->label("父菜单") ?>  
  22.   
  23.         <?= $form->field($model'classurl')->textInput(['id' => 'route']) ?>  
  24.   
  25.         <?= $form->field($model'intro')->textarea(['class'=>'form-control']) ?>  
  26.   
  27.         <?= $form->field($model'sort')->input('number') ?>  
  28.   
  29.     </div>  
  30.   
  31.     <div class="card-footer">  
  32.   
  33.         <div class="col-md-10 offset-sm-2">  
  34.         <?=  
  35.         Html::submitButton($model->isNewRecord ? Yii::t('rbac-admin''Create') : Yii::t('rbac-admin''Update'), ['class' => $model->isNewRecord  
  36.             ? 'btn btn-success' : 'btn btn-primary'])  
  37.         ?>  
  38.         </div>  
  39.   
  40.     </div>  
  41.     <?php ActiveForm::end(); ?>  
  42. </div>  

 

 WX20200226-141830@2x.png

PHP Code复制内容到剪贴板
  1. <div class="card card-primary">  
  2.                         <div class="card-header">  
  3.                             <h3 class="card-title">栏目选项</h3>  
  4.   
  5.                             <div class="card-tools">  
  6.                                 <button type="button" class="btn btn-tool" data-card-widget="collapse"><i  
  7.                                             class="fas fa-minus"></i>  
  8.                                 </button>  
  9.                             </div>  
  10.                             <!-- /.card-tools -->  
  11.                         </div>  
  12.                         <!-- /.card-header -->  
  13.                         <div class="card-body">  
  14.   
  15.                             <?= $form->field($model'showclass', [  
  16.                                 'template' => "{label}\n<div class='col-md-3 col-form-label'>{input}</div><div class='col-md-3 col-form-label text-gray'>(如:导航标签,地图标签)</div>\n{hint}\n{error}"  
  17.                             ])->radioList(  
  18.                                 ['1' => '显示''0' => '不显示'],  
  19.                                 [  
  20. //                                    'tag' => false,  
  21.                                     'item' => function ($index$label$name$checked$value) {  
  22.                                         $c = $checked ? "checked" : "";  
  23.                                         $template = '<input type="radio" name="' . $name . '" value="' . $index . '" title="' . $label . '" ' . $c . '><label class="form-check-label ml-2 mr-2"> ' . $label . '</label>';  
  24.                                         return $template;  
  25.                                     }  
  26.                                 ]) ?>  
  27.   
  28.                             <?= $form->field($model'sort', [  
  29.                                 'template' => "{label}\n<div class='col-md-3'>{input}</div><div class='col-md-3 col-form-label text-gray'>(值越小越前面)</div>\n{hint}\n{error}"  
  30.                             ])->input('number') ?>  
  31.   
  32.                         </div>  
  33.                         <!-- /.card-body -->  
  34.                     </div>  
  35.                     <!-- /.card -->  

 

 

PHP Code复制内容到剪贴板
  1. <div class="card card-primary">  
  2.                         <div class="card-header">  
  3.                             <h3 class="card-title">后台信息发布设置</h3>  
  4.   
  5.                             <div class="card-tools">  
  6.                                 <button type="button" class="btn btn-tool" data-card-widget="collapse"><i  
  7.                                             class="fas fa-minus"></i>  
  8.                                 </button>  
  9.                             </div>  
  10.                             <!-- /.card-tools -->  
  11.                         </div>  
  12.                         <!-- /.card-header -->  
  13.                         <div class="card-body">  
  14.   
  15.                             <div class="form-group row field-enewsclass-islast required">  
  16.                                 <label class="col-md-2 col-form-label text-right">增加/编辑信息</label>  
  17.                                 <div class="col-md-2 col-form-label">  
  18.   
  19.                                     <?= Html::activeCheckboxList($model"addreinfo", ['1' => '生成内容页'], [  
  20. //                    'class'=>'form-check',  
  21.                                         'item' => function ($index$label$name$checked$value) {  
  22.                                             $c = $checked ? "checked" : "";  
  23.                                             $template = '<input type="checkbox" name="' . $name . '" value="' . $index . '" title="' . $label . '" ' . $c . '><label class="form-check-label ml-2"> ' . $label . '</label>';  
  24.                                             return $template;  
  25.                                         },  
  26.                                     ]); ?>  
  27.   
  28.   
  29.                                     <?= Html::activeCheckboxList($model"repreinfo", ['1' => '生成上一篇信息'], [  
  30.                                         'item' => function ($index$label$name$checked$value) {  
  31.                                             $c = $checked ? "checked" : "";  
  32.                                             $template = '<input type="checkbox" name="' . $name . '" value="' . $index . '" title="' . $label . '" ' . $c . '><label class="form-check-label ml-2"> ' . $label . '</label>';  
  33.                                             return $template;  
  34.                                         },  
  35.                                     ]); ?>  
  36.   
  37.                                     <?= Html::activeCheckboxList($model"sametitle", ['1' => '检测标题重复'], [  
  38.                                         'item' => function ($index$label$name$checked$value) {  
  39.                                             $c = $checked ? "checked" : "";  
  40.                                             $template = '<input type="checkbox" name="' . $name . '" value="' . $index . '" title="' . $label . '" ' . $c . '><label class="form-check-label ml-2"> ' . $label . '</label>';  
  41.                                             return $template;  
  42.                                         },  
  43.                                     ]); ?>  
  44.   
  45.                                 </div>  
  46.   
  47.                                 <label class="col-md-2 col-form-label text-right">生成列表:</label>  
  48.                                 <div class="col-md-2">  
  49.   
  50.                                     <?= Html::activeDropDownList($model"haddlist", ['0' => '不生成','1'=>'生成当前栏目','2'=>'生成首页','3'=>'生成父栏目','4'=>'生成当前栏目与父栏目','5'=>'生成父栏目与首页','6'=>'生成当前栏目、父栏目与首页'],['class'=>'form-control']); ?>  
  51.                                 </div>  
  52.   
  53.                             </div>  
  54.   
  55.                             <?=$form->field($model,"wfid",[  
  56.                                 'template' => "{label}\n<div class='col-md-3'>{input}</div>\n{hint}\n{error}"  
  57.                             ])->dropDownList([], ['prompt'=>'不使用工作流'])?>  
  58.   
  59.                         </div>  
  60.                         <!-- /.card-body -->  
  61.                     </div>  
  62.                     <!-- /.card -->  

 

 

 

 

本文来自于:http://www.yoyo88.cn/note/yoyocmf/496.html

上一篇 V2.0版本
Powered by yoyo苏ICP备15045725号-1