PHP code example of cyberitas / yii2-tinymce-processor

1. Go to this page and download the library: Download cyberitas/yii2-tinymce-processor library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

cyberitas / yii2-tinymce-processor example snippets


use Cyberitas\TinymceProcessor\TinymceProcessor;

$tmp = new TinymceProcessor(['config' => [
    'autop' => true,
    'essence' => true,
    'purify' => [
        'purifierConfig' => [
            'Attr.EnableId' => true
        ]
    ],
    'texturize' => [
        'leftDoubleQuote' => '&laquo;',
        'rightDoubleQuote' => '&raquo;'
    ]
]]);
$output = $tmp->process("This is some content from a TinyMCE editor.");

use Cyberitas\TinymceProcessor\Assets\TinymceAssets;
use yii\helpers\Html;
use yii\widgets\InputWidget;

class TinymceWidget extends InputWidget
{
    public function run()
    {
        TinymceAssets::register($this->view);
        $this->view->registerJs('tinymce.init({selector: "textarea"});');
        echo Html::textarea($this->name, $this->value);
    }
}