Advertisement
Guest User

Untitled

a guest
Feb 20th, 2020
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.54 KB | None | 0 0
  1. <?php
  2.  
  3. use trntv\filekit\widget\Upload;
  4. use trntv\yii\datetime\DateTimeWidget;
  5. use yii\helpers\Html;
  6. use yii\bootstrap\ActiveForm;
  7.  
  8. /* @var $this yii\web\View */
  9. /* @var $model common\models\Article */
  10. /* @var $categories common\models\ArticleCategory[] */
  11. /* @var $form yii\bootstrap\ActiveForm */
  12. ?>
  13.  
  14. <div class="article-form">
  15.  
  16. <?php $form = ActiveForm::begin(); ?>
  17.  
  18. <?php echo $form->field($model, 'title')->textInput(['maxlength' => true]) ?>
  19.  
  20. <?php echo $form->field($model, 'slug')
  21. ->hint(Yii::t('backend', 'If you\'ll leave this field empty, slug will be generated automatically'))
  22. ->textInput(['maxlength' => true]) ?>
  23.  
  24. <?php echo $form->field($model, 'category_id')->dropDownList(\yii\helpers\ArrayHelper::map(
  25. $categories,
  26. 'id',
  27. 'title'
  28. ), ['prompt'=>'']) ?>
  29.  
  30. <?php echo $form->field($model, 'body')->widget(
  31. \yii\imperavi\Widget::className(),
  32. [
  33. 'plugins' => ['fullscreen', 'fontcolor', 'video', 'fontsize'],
  34. 'options' => [
  35. 'minHeight' => 400,
  36. 'maxHeight' => 400,
  37. 'buttonSource' => true,
  38. 'convertDivs' => false,
  39. 'removeEmptyTags' => false,
  40. 'imageUpload' => Yii::$app->urlManager->createUrl(['/file-storage/upload-imperavi'])
  41. ]
  42. ]
  43. ) ?>
  44.  
  45. <?php echo $form->field($model, 'thumbnail')->widget(
  46. Upload::className(),
  47. [
  48. 'url' => ['/file-storage/upload'],
  49. 'maxFileSize' => 5000000, // 5 MiB
  50. ]);
  51. ?>
  52.  
  53. <?php echo $form->field($model, 'attachments')->widget(
  54. Upload::className(),
  55. [
  56. 'url' => ['/file-storage/upload'],
  57. 'sortable' => true,
  58. 'maxFileSize' => 10000000, // 10 MiB
  59. 'maxNumberOfFiles' => 10
  60. ]);
  61. ?>
  62.  
  63. <?php echo $form->field($model, 'view')->textInput(['maxlength' => true]) ?>
  64.  
  65. <?php echo $form->field($model, 'status')->checkbox() ?>
  66.  
  67. <?php echo $form->field($model, 'published_at')->widget(
  68. DateTimeWidget::className(),
  69. [
  70. 'phpDatetimeFormat' => 'yyyy-MM-dd\'T\'HH:mm:ssZZZZZ'
  71. ]
  72. ) ?>
  73.  
  74. <div class="form-group">
  75. <?php echo Html::submitButton(
  76. $model->isNewRecord ? Yii::t('backend', 'Create') : Yii::t('backend', 'Update'),
  77. ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
  78. </div>
  79.  
  80. <?php ActiveForm::end(); ?>
  81.  
  82. </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement