= $form->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('Новость')?>
= $form->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
]
])?>
= $form->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
]
])?>