Web Developer
Web Developer

Reputation: 133

Customizing ckeditor to accept html and body tags using yii2-ckeditor-widget

I am using 2 amigos ckeditor widget

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

How do I add the configuration settings, I want the editor to accept HTML tags hTML and body which the editor usually stripes off. Where do i specify this setings in the widget.

Upvotes: 2

Views: 1251

Answers (2)

Web Developer
Web Developer

Reputation: 133

So i added the configuration 'allowedContent' => true and it worked.

Upvotes: 0

arogachev
arogachev

Reputation: 33538

There is special property called clientOptions for setting plugin options.

For filtering tags use allowedContent option, you can read official docs here.

Here is an example of code:

<?= $form->field($model, 'text')->widget(CKEditor::className(), [
    'options' => ['rows' => 6],
    'preset' => 'basic',
    'clientOptions' => [
        'allowedContent' => ...,
    ],
]) ?>

Upvotes: 4

Related Questions