简体   繁体   中英

How do I integrate CKEditor into Yii2 without creating widget?

I looked at widgets 2amigos and MihailDev . They both work fine like this:

echo $form->field($model, 'text')->widget(CKEditor::className(), [
    'options' => ['rows' => 6],
    'preset' => 'basic'
])

but I have to use only CKEditor assets without creating a widget.

CKEditorAsset::register($this);
$activeForm = ActiveForm::begin();
echo $activeForm->field($model, 'text')->textarea();
ActiveForm::end();

Of course this displays a simple textarea field.

echo $activeForm->field($model, 'text')->textarea(['class'=>'ckeditor']);

This displays a text area with CKEditor options. ckeditor help

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM