_gallery_form.php 1.4 KB
<?php
    /**
     * @var Gallery $gallery
     * @var User $user
     */
    use common\models\Gallery;
    use common\models\User;
    use common\widgets\FieldEditor;
    use common\widgets\ImageUploader;
    use mihaildev\ckeditor\CKEditor;
    use yii\helpers\Html;
    use yii\widgets\ActiveForm;

    $this->title = 'Мой профиль';
    $this->params[ 'breadcrumbs' ][] = $this->title;
?>
<h1><?= $this->title ?></h1>

<?php
    $form = ActiveForm::begin();
?>

<?= $gallery->date_add ?>

<?= $form->field($gallery, 'name')
         ->textInput() ?>

<?= ImageUploader::widget([
    'model'   => $gallery,
    'field'   => 'cover',
    'width'   => 100,
    'height'  => 100,
    'multi'   => false,
    'gallery' => $gallery->cover,
    'name'    => 'Загрузить главное фото',
]); ?>

<?= $form->field($gallery, 'type')
         ->radioList([
             1 => 'Фото',
             2 => 'Видео',
         ]) ?>

<?= ImageUploader::widget([
    'model'   => $gallery,
    'field'   => 'photo',
    'width'   => 100,
    'height'  => 100,
    'multi'   => true,
    'gallery' => $gallery->photo,
    'name'    => 'Загрузить фото галереи',
]); ?>

<?= FieldEditor::widget (
    [
        'template' => 'youtube', 'item_id' => $user->id, 'model' => 'common\models\User', 'language' => 'ru',
    ]
); ?>

<?= Html::submitButton('Добавить') ?>

<?php
    $form->end();
?>