_form_common.php 1.56 KB
<?php
    
    use artbox\catalog\models\Product;
    use artbox\catalog\models\ProductLang;
    use artbox\core\components\imagemanager\components\ImageManagerInputWidget;
    use artbox\core\widgets\LanguageForm;
    use yii\web\View;
    use yii\widgets\ActiveForm;
    
    /**
     * @var ProductLang[] $modelLangs
     * @var Product       $model
     * @var ActiveForm    $form
     * @var View          $this
     */
?>

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

<?php
    echo $form->field($model, 'image_id')
              ->widget(
                  ImageManagerInputWidget::className(),
                  [
                      'aspectRatio'                  => ( 16 / 9 ),
                      //set the aspect ratio
                      'showPreview'                  => true,
                      //false to hide the preview
                      'showDeletePickedImageConfirm' => false,
                      //on true show warning before detach image
                  ]
              );
?>

<?= LanguageForm::widget(
    [
        'modelLangs' => $modelLangs,
        'formView'   => '@artbox/catalog/views/variant/_form_language',
        'form'       => $form,
    ]
) ?>

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

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

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

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

<?= $form->field($model, 'status')
         ->checkbox(
             [
                 'class' => 'flat',
             ]
         ) ?>