role.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. use yii\widgets\ActiveForm;
  3. use common\helpers\Url;
  4. use common\helpers\Html;
  5. $form = ActiveForm::begin([
  6. 'id' => $model->formName(),
  7. 'enableAjaxValidation' => true,
  8. 'validationUrl' => Url::to(['role', 'id' => $id]),
  9. 'fieldConfig' => [
  10. 'template' => "<div class='row'><div class='col-sm-3 text-right'>{label}</div><div class='col-sm-9'>{input}\n{hint}\n{error}</div></div>",
  11. ]
  12. ]);
  13. ?>
  14. <div class="modal-header">
  15. <h4 class="modal-title">基本信息</h4>
  16. <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
  17. </div>
  18. <div class="modal-body">
  19. <?= $form->field($model, 'role_ids')->widget(\kartik\select2\Select2::class, [
  20. 'data' => $model->roles,
  21. 'options' => [
  22. 'placeholder' => '选择授权角色',
  23. 'multiple' => true
  24. ],
  25. 'pluginOptions' => [
  26. 'tags' => true,
  27. 'tokenSeparators' => [',', ' '],
  28. 'maximumInputLength' => 20
  29. ],
  30. ]);?>
  31. <?= Html::modelBaseCss(); ?>
  32. </div>
  33. <div class="modal-footer">
  34. <button type="button" class="btn btn-white" data-dismiss="modal">关闭</button>
  35. <button class="btn btn-primary" type="submit">保存</button>
  36. </div>
  37. <?php ActiveForm::end(); ?>
粤ICP备19079148号