<?php
use \yii\data\ActiveDataProvider;
use \common\modules\analyticsSchool\models\AnalyticsSchoolLessonFile;

return [
    'activeForm' => [
        'id' => 'trigger-form',
        'options' => [
            'enctype' => 'multipart/form-data'
        ]
    ],
    'elements' => [
        'name' => [
            'type' => 'text',
            'class' => 'form-control'
        ],
        'course_id' => [
            'type' => 'dropdownlist',
            'items' => \yii\helpers\ArrayHelper::map(\common\modules\analyticsSchool\models\AnalyticsSchoolCourse::find()->all(), 'id', 'name')
        ],
        'video_link' => [
            'type' => 'text',
            'class' => 'form-control'
        ],
        'content' => [
            'type' => 'textarea',
            'class' => 'form-control'
        ],
        Yii::$app->controller->renderPartial(
            '_files',
            [
                'model' => $this->model,
                'dataProvider' => new ActiveDataProvider([
                        'query' => AnalyticsSchoolLessonFile::find()->where([
                                'lesson_id' => $this->model->id
                            ])
                    ])
            ]),
    ],
    'buttons' => [
        'submit' => ['type' => 'submit', 'value' => 'Cохранить']
    ]
];