示例#1
0
use yii\helpers\ArrayHelper;
use zxbodya\yii2\galleryManager\GalleryManager;
use mihaildev\ckeditor\CKEditor;
/* @var $this yii\web\View */
/* @var $model backend\models\KskPosts */
/* @var $form yii\widgets\ActiveForm */
?>

<div class="ksk-posts-form">

    <?php 
$form = ActiveForm::begin();
?>
    
    <?php 
$listCategories = ArrayHelper::map(KskCategories::find()->orderBy('name')->all(), 'id', 'name');
?>

    <!--?= $form->field($model, 'category_id')->textInput(['maxlength' => true]) ?-->
    <?php 
echo $form->field($model, 'category_id')->dropDownList($listCategories, ['prompt' => 'Выберите категорию...']);
?>

    <!--?= $form->field($model, 'title')->textarea(['rows' => 6]) ?-->
    <?php 
echo $form->field($model, 'title')->textInput(['maxlength' => true]);
?>

    <!--?= $form->field($model, 'content')->textarea(['rows' => 8]) ?-->
    <?php 
echo $form->field($model, 'content')->widget(CKEditor::className(), ['editorOptions' => ['preset' => 'full', 'inline' => false]]);
 /**
  * Lists all KskCategories models.
  * @return mixed
  */
 public function actionIndex()
 {
     $dataProvider = new ActiveDataProvider(['query' => KskCategories::find()]);
     return $this->render('index', ['dataProvider' => $dataProvider]);
 }