2017-08-10 52 views
0

我使用yii2 dosamigos ckeditor扩展。yii2没有模型的ckeditor部件

echo $form->field($modelPatientTest, 'template_data')->widget(\dosamigos\ckeditor\CKEditor::className(), [ 
      'options' => ['rows' => 3,'value' => $templateData], 
      'preset' => 'full', 
      'name' => 'modalckeditor', 
      'clientOptions' => ['height' => 200,'width'=>750] 
     ]); 

我想使用它没有模型,以便我可以设置自定义名称。像以下

<?php echo Html::textInput("TestValue[{$test->test_group_id}][{$test->id}]", $test_value, ['class' => 'form-control inputvalue']); ?> 

任何人都可以帮忙吗?

回答

0

如果我正确理解你的问题。

这是使用它没有模型的方式,根据2amigos

use dosamigos\ckeditor\CKEditorInline; 

<?php CKEditorInline::begin(['preset' => 'basic']);?> 
    This text can be edited now :) 
<?php CKEditorInline::end();?> 

编辑:

如果要更改名称/ ID,有2个答案在堆栈溢出,这可能有助于你herehere

+1

有CKEDITOR和CKEditorInline之间的区别......我是说只是CKEDITOR不在线......不过我解决了自己被下面的代码... echo CKEditor :: widget([ 'name'=>“TestValue [{$ testGroup-> id}]”, 'id'=>'patienttest-template_data', 'preset'=>'full', 'value'=> $ templateData, 'clientOptions'=> ['height'=> 200,'width'=> 750], ]); –