' + '
' + '' + '' + repo.title + '' + '
' + ''; return '
' + markup + '
'; }; var formatRepoSelection = function (repo) { return repo.title; } JS; $this->registerJs($formatJs, View::POS_HEAD); $resultsJs = <<< JS function (data, params) { params.page = params.page || 1; return { results: data.items, pagination: { more: (params.page * 30) < data.total_count } }; } JS; ?>
field($model, 'post_id')->widget( \kartik\select2\Select2::class,[ "value"=>$model->post_id, 'initValueText' => !is_null($model->post)?$model->post->title:"asdasd", "options"=>["value"=>$model->post_id], 'pluginOptions' => [ //'allowClear' => true, 'selectOnClose' => true, 'ajax' => [ 'url' => \yii\helpers\Url::to(['/manager/top-slider/find-news']), 'dataType' => 'json', 'data' => new JsExpression('function(params) { return {q:params.term, page: params.page}; }'), 'processResults' => new JsExpression($resultsJs), 'cache' => true, 'delay' => 1000, ], 'escapeMarkup' => new JsExpression('function (markup) { return markup; }'), 'templateResult' => new JsExpression('formatRepo'), 'templateSelection' => new JsExpression('formatRepoSelection'), ] ])->label('Новость')?>
field($model, 'published_from')->widget(DateTimePicker::classname(), [ 'name' => 'published_from', 'options' => ['class' => 'form-control'], 'convertFormat' => true, 'type' => DateTimePicker::TYPE_COMPONENT_PREPEND, 'pluginOptions' => [ 'format' => 'yyyy-MM-dd hh:i:s', 'startDate' => '2023-01-01 12:00', 'todayHighlight' => true, 'autoclose'=>true ] ])?>
field($model, 'published_to')->widget(DateTimePicker::classname(), [ 'name' => 'published_to', 'options' => ['class' => 'form-control'], 'convertFormat' => true, 'type' => DateTimePicker::TYPE_COMPONENT_PREPEND, 'pluginOptions' => [ 'format' => 'yyyy-MM-dd hh:i:s', 'startDate' => '2023-01-01 12:00', 'todayHighlight' => true, 'autoclose'=>true ] ])?>
field($model, 'is_active')->checkbox() ?>
'btn btn-success']) ?>