我从这里下载了CKEditor https://github.com/2amigos/yii2-ckeditor-widget 现在我想整合代码段http://docs.ckeditor.com/#!/guide/dev_codesnippet
Mayby有人可以解释一下如何逐步完成这项工作吗?我通过composer下载了ckeditor后添加了
echo $form->field($model, 'instruction')->textarea()
->widget(CKEditor::className(), [
'options' => ['rows' => 6],
'preset' => 'full'
]);
我现在如何整合代码段?
答案 0 :(得分:1)
Composer软件包安装在应用程序根目录的vendor
目录中。我打赌它会像vendor/dosamigos/ckeditor
。您应该找到plugins文件夹,您可以在其中相应地安装CKEditor文档的代码段。然后当你在Yii2代码中使用它时,写下类似于:
<?= $form->field($model, 'field_name')->widget(CKEditor::className(), [
'options' => ['rows' => 10],
'preset' => 'full',
'clientOptions' => ['extraPlugins' => 'codesnippet']
]) ?>
答案 1 :(得分:-2)
您只需在表单文件中添加以下代码:
<?= $form->field($model, 'field_name')->widget(CKEditor::className(), [
'options' => ['rows' => 10],
'preset' => 'full',
]) ?>