Blame view

views/brand/_form.php 2.41 KB
b7e90569   Yarik   Namespaces
1
2
  <?php

      

2e22f66f   Yarik   Links fixed
3
4
5
6
      use artweb\artbox\components\artboximage\ArtboxImageHelper;

      use artweb\artbox\language\widgets\LanguageForm;

      use artweb\artbox\ecommerce\models\Brand;

      use artweb\artbox\ecommerce\models\BrandLang;

b7e90569   Yarik   Namespaces
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
      use yii\helpers\Html;

      use yii\web\View;

      use yii\widgets\ActiveForm;

      

      /**

       * @var View        $this

       * @var Brand       $model

       * @var ActiveForm  $form

       * @var BrandLang[] $modelLangs

       */

  ?>

  

  <div class="brand-form">

      

      <?php $form = ActiveForm::begin([

          'enableClientValidation' => false,

          'options'                => [ 'enctype' => 'multipart/form-data' ],

      ]); ?>

      

      <?= $form->field($model, 'image')

               ->widget(\kartik\file\FileInput::className(), [

                   'language'      => 'ru',

                   'options'       => [

                       'accept'   => 'image/*',

                       'multiple' => false,

                   ],

                   'pluginOptions' => [

                       'allowedFileExtensions' => [

                           'jpg',

                           'gif',

                           'png',

                       ],

2e22f66f   Yarik   Links fixed
39
                       'initialPreview'        => !empty( $model->imageUrl ) ? ArtboxImageHelper::getImage($model->imageUrl, 'list') : '',

b7e90569   Yarik   Namespaces
40
41
42
43
44
45
46
47
48
49
50
                       'overwriteInitial'      => true,

                       'showRemove'            => false,

                       'showUpload'            => false,

                       'previewFileType'       => 'image',

                   ],

               ]); ?>

      

      <?= $form->field($model, 'in_menu')->dropDownList([\Yii::t('product', 'No'), \Yii::t('product', 'Yes')]); ?>

      

      <?= LanguageForm::widget([

          'modelLangs' => $modelLangs,

2e22f66f   Yarik   Links fixed
51
          'formView'    => '@artweb/artbox/ecommerce/views/brand/_form_language',

b7e90569   Yarik   Namespaces
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
          'form'        => $form,

      ]) ?>

      

      <div class="form-group">

          <?= Html::submitButton($model->isNewRecord ? Yii::t('product', 'Create') : Yii::t('product', 'Update'), [ 'class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary' ]) ?>

          <?php if($model->isNewRecord) : ?>

              <?= Html::submitButton(Yii::t('product', 'Create and continue'), [

                  'name'  => 'create_and_new',

                  'class' => 'btn btn-primary',

              ]) ?>

          <?php endif ?>

      </div>

      

      <?php ActiveForm::end(); ?>

  

  </div>