request; $id = $request->get('id'); if( $id ){ $this->title="Редактирование статьи"; $news = \app\models\News::find()->andWhere(['id'=>$id])->one(); // print_a( $news ); }else{ $this->title="Новая статья"; $anews = [ 'title' => '' ]; $news = new \app\models\News();; $news->title = ''; } $form = ActiveForm::begin([ 'id' => 'login-form', 'options' => ['class' => 'form-horizontal'],]); echo $form->field($news, 'dt_pub')->widget( DateTimePicker::class, [ 'options' => ['placeholder' => 'Время публикации'], 'convertFormat' => true, 'pluginOptions' => [ 'format' => 'dd-MM-yyyy HH:i', 'type' => DateTimePicker::TYPE_COMPONENT_PREPEND, 'startDate' => '01-Mar-2014 12:00', 'todayHighlight' => true, 'language' => 'ru_RU', 'autoclose' => true, ] ] )->label('Дата публикации'); echo $form->field($news, 'title')->textInput([ 'maxlength' => true, 'class' => 'form-control js-word-count-input', 'placeholder' => 'Заголовок новости' ])->label('Заголовок'); ?>
0 из 80
field($news, 'lid')->textarea([ 'maxlength' => true, 'class' => 'form-control js-word-count-input', 'placeholder' => 'Лид' ])->label('Новость кратко'); /* echo $form->field($news, 'text')->textarea([ 'maxlength' => true, 'class' => 'form-control js-word-count-input', ])->widget(CKEditor::className(),[ 'editorOptions' => [ 'preset' => 'full', //разработанны стандартные настройки basic, standard, full данную возможность не обязательно использовать 'inline' => false, //по умолчанию false ], ]); */ /* echo $form->field($news, 'text')->widget(CKEditor::className(), [ 'options' => ['rows' => 6], 'preset' => 'basic' ]); */ $kcfOptions = array_merge(KCFinder::$kcfDefaultOptions, [ 'uploadURL' => Yii::getAlias('@web').'/images/design/', 'uploadDir' => '@webroot/images/design/', 'disabled'=> false, 'access' => [ 'files' => [ 'upload' => true, 'delete' => true, 'copy' => true, 'move' => true, 'rename' => true, ], 'dirs' => [ 'create' => true, 'delete' => true, 'rename' => true, ], ], 'types' => array( // (F)CKEditor types 'files' => "pdf doc xsl mp3 wav ogv docx m4a wma ogg oga wav", 'flash' => "swf", 'images' => "*img", 'audio' => "mp3 wav ogv m4a wma ogg oga", // TinyMCE types 'file' => "", 'media' => "swf flv avi mpg mpeg qt mov wmv asf rm", 'image' => "*img", ), ]); Yii::$app->session->set('KCFINDER', $kcfOptions); echo $form->field($news, 'text')->widget(CKEditor::className(), [ 'kcfinder' => true,]); echo Html::submitButton('Send', ['class' => 'btn btn-success']); ActiveForm::end();