2017-08-10 55 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], ]); –