<?php

use common\widgets\FieldEditor;
use yii\helpers\Html;
use yii\widgets\ActiveForm;
use common\modules\file\widgets\ImageUploader;
use mihaildev\ckeditor\CKEditor;
use mihaildev\elfinder\ElFinder;
use common\components\Request;

/* @var $this yii\web\View */
/* @var $model common\models\Blog */
/* @var $form yii\widgets\ActiveForm */
?>

<div class="blog-form">

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

    <?= $form->field($model, 'name')->textInput(['maxlength' => true]) ?>

    <?= $form->field($model, 'link')->textInput(['maxlength' => true]) ?>

    <?= $form->field($model, 'description')->widget(CKEditor::className(),
        [
            'editorOptions' => ElFinder::ckeditorOptions('elfinder',[
                    'preset' => 'full', //разработанны стандартные настройки basic, standard, full данную возможность не обязательно использовать
                    'inline' => false, //по умолчанию false]),
                    'filebrowserUploadUrl'=>Yii::$app->getUrlManager()->createUrl('file/uploader/images-upload')
                ]
            )
        ]) ?>

    <?=
    ImageUploader::widget([
        'model'=> $model,
        'field'=>'cover',
        'size' => [
            [
                'width'=>340,
                'height'=>260,
            ]
        ],
        'multi'=>true,
        'gallery' =>$model->cover,
        'name' => 'Загрузить миниатюру статьи'
    ]);
    ?>

    <?= FieldEditor::widget([
        'template' => 'education',
        'item_id'  => $model->blog_id,
        'model'    => 'common\models\Blog',
        'language' => 'ru',
    ]); ?>
    <div class="form-group">
        <?= Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
    </div>

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

</div>
