PHP code example of alexantr / yii2-tinymce
1. Go to this page and download the library: Download alexantr/yii2-tinymce 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/ */
alexantr / yii2-tinymce example snippets
<?= alexantr\tinymce\TinyMCE::widget(['name' => 'attributeName'])
<?= alexantr\tinymce\TinyMCE::widget([
'name' => 'attributeName',
'clientOptions' => [
'plugins' => [
'anchor', 'charmap', 'code', 'help', 'hr',
'image', 'link', 'lists', 'media', 'paste',
'searchreplace', 'table',
],
'height' => 500,
'convert_urls' => false,
'element_format' => 'html',
// ...
],
])
<?= $form->field($model, 'attributeName')->widget(alexantr\tinymce\TinyMCE::className(), [
'clientOptions' => [
// ...
],
])
return [
'plugins' => [
'anchor', 'charmap', 'code', 'help', 'hr',
'image', 'link', 'lists', 'media', 'paste',
'searchreplace', 'table',
],
'height' => 500,
'convert_urls' => false,
'element_format' => 'html',
'image_caption' => true,
'keep_styles' => false,
'paste_block_drop' => true,
'table_default_attributes' => new yii\web\JsExpression('{}'),
'table_default_styles' => new yii\web\JsExpression('{}'),
'invalid_elements' => 'acronym,font,center,nobr,strike,noembed,script,noscript',
'extended_valid_elements' => 'strong/b,em/i,table[style]',
// elFinder file manager https://github.com/alexantr/yii2-elfinder
'file_picker_callback' => alexantr\elfinder\TinyMCE::getFilePickerCallback(['elfinder/tinymce']),
];
<?= alexantr\tinymce\TinyMCE::widget([
'name' => 'attributeName',
'presetPath' => '@backend/config/my-tinymce-config.php',
'clientOptions' => [
'height' => 1000,
],
])