Skip to content
TinyMCE widget for Yii 2
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

TinyMCE widget for Yii 2

This extension renders a TinyMCE widget for Yii framework 2.0.

Latest Stable Version Total Downloads License


Install extension through composer:

composer require alexantr/yii2-tinymce


The following code in a view file would render a TinyMCE widget:

<?= alexantr\tinymce\TinyMCE::widget(['name' => 'attributeName']) ?>

Configuring the TinyMCE options should be done using the clientOptions attribute:

<?= alexantr\tinymce\TinyMCE::widget([
    'name' => 'attributeName',
    'clientOptions' => [
        'plugins' => ['advlist', 'anchor', 'charmap', 'image', 'hr', 'imagetools', 'link', 'lists', 'media', 'paste', 'table'],
        'height' => 500,
        'convert_urls' => false,
        'invalid_elements' => 'acronym,font,center,nobr,strike,noembed,script,noscript',
]) ?>

If you want to use the TinyMCE widget in an ActiveForm, it can be done like this:

<?= $form->field($model, 'attributeName')->widget(alexantr\tinymce\TinyMCE::className()) ?>

Using global configuration (presets)

To avoid repeating identical configuration in every widget you can set global configuration in @app/config/tinymce.php. Options from widget's clientOptions will be merged with this configuration.

You can change default path with presetPath attribute:

<?= alexantr\tinymce\TinyMCE::widget([
    'name' => 'attributeName',
    'presetPath' => '@backend/config/my-tinymce-config.php',
]) ?>
You can’t perform that action at this time.