protected function add_js_plugin(&$params, $pluginname='', $jsfile='editor_plugin.js') {
        global $CFG;

        // Set default plugin name.
        if ($pluginname === '') {
            $pluginname = $this->plugin;
        }

        // Add plugin to list in params, so it doesn't try to load it again.
        $params['plugins'] .= ',-' . $pluginname;

        // Add special param that causes Moodle TinyMCE init to load the plugin.
        if (!isset($params['moodle_init_plugins'])) {
            $params['moodle_init_plugins'] = '';
        } else {
            $params['moodle_init_plugins'] .= ',';
        }

        // Get URL of main JS file and store in params.
        $jsurl = $this->get_tinymce_file_url($jsfile, false);
        $params['moodle_init_plugins'] .= $pluginname . ':' . $jsurl;
    }
protected function add_js_plugin(&$params, $pluginname='', $jsfile='editor_plugin.js') {
        global $CFG;

        // Set default plugin name.
        if ($pluginname === '') {
            $pluginname = $this->plugin;
        }

        // Add plugin to list in params, so it doesn't try to load it again.
        $params['plugins'] .= ',-' . $pluginname;

        // Add special param that causes Moodle TinyMCE init to load the plugin.
        if (!isset($params['moodle_init_plugins'])) {
            $params['moodle_init_plugins'] = '';
        } else {
            $params['moodle_init_plugins'] .= ',';
        }

        // Get URL of main JS file and store in params.
        $jsurl = $this->get_tinymce_file_url($jsfile, false);
        $params['moodle_init_plugins'] .= $pluginname . ':' . $jsurl;
    }
protected function add_js_plugin ( & $ params , $ pluginname = '' , $ jsfile = 'editor_plugin.js' ) { global $ CFG ; // Set default plugin name. if ( $ pluginname === '' ) { $ pluginname = $ this -> plugin ; } // Add plugin to list in params, so it doesn't try to load it again. $ params [ 'plugins' ] .= ',-' . $ pluginname ; // Add special param that causes Moodle TinyMCE init to load the plugin. if ( ! isset ( $ params [ 'moodle_init_plugins' ] ) ) { $ params [ 'moodle_init_plugins' ] = '' ; } else { $ params [ 'moodle_init_plugins' ] .= ',' ; } // Get URL of main JS file and store in params. $ jsurl = $ this -> get_tinymce_file_url ( $ jsfile , false ) ; $ params [ 'moodle_init_plugins' ] .= $ pluginname . ':' . $ jsurl ; }
Adds a JavaScript plugin into TinyMCE. Note that adding a plugin does
not by itself add a button; you must do both.

If you leave $pluginname blank (default) it uses the folder name.

@param array $params TinyMCE init parameters array
@param string $pluginname Identifier for plugin within TinyMCE
@param string $jsfile Name of JS file (within plugin 'tinymce' directory)
Adds a JavaScript plugin into TinyMCE . Note that adding a plugin does not by itself add a button ; you must do both .