PHP code example of markocupic / tinymce_plugin_builder

1. Go to this page and download the library: Download markocupic/tinymce_plugin_builder 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/ */

    

markocupic / tinymce_plugin_builder example snippets



// system/modules/tinymce_mysuperplugin/config/config.php


// Add stylesheet
$GLOBALS['TL_CSS'][] = 'system/modules/tinymce_newslink/assets/css/newslink.css';

// Add a plugin to the tinymce editor
$GLOBALS['TINYMCE']['SETTINGS']['PLUGINS'][] = 'newslink';

// Add a button to the toolbar in tinymce editor
$GLOBALS['TINYMCE']['SETTINGS']['TOOLBAR'][] = 'newslink';

// Add a new config row to the tinymce.init method (string)
$GLOBALS['TINYMCE']['SETTINGS']['CONFIG_ROW']['test_string'] = "'This is a test string, and you have to quote it with a single quote.'";

// Add a new config row to the tinymce.init method (json_encoded array from a PHP class)
$GLOBALS['TINYMCE']['SETTINGS']['CONFIG_ROW']['newslink_news_data'] = json_encode(TinymceNewslink\TinymceNewslink::getContaoNewsArchivesAsJSON());

// Add a new config row to the tinymce.init method (use the loadLanguageFile-hook)
$GLOBALS['TL_HOOKS']['loadLanguageFile'][] = array('TinymceNewslink\TinymceNewslink', 'loadLanguageData');