Note: You are currently viewing documentation for Moodle 2.4. Up-to-date documentation for the latest stable version of Moodle may be available here: Sandbox.

Sandbox

From MoodleDocs
Revision as of 13:53, 21 July 2013 by Josep Pepe (talk | contribs) (First steps editing a page)

First steps creating a Moodle specific TinyMCE plugin (for dummies)

This page describes the first steps of how to custom Moodle plugins for TinyMCE implemented in MOODLE 2.5

This page is based on the https://docs.moodle.org/dev/TinyMCE_plugins information.

Overview

First of all, lets clarify that the plugin structure for TinyMCE in Moodle is a bit diferent than the pure TinyMCE plugin, so dont confuse them.

Directory /lib/editor/tinymce/plugins/ contains Moodle specific TinyMCE plugins. It supports all standard Moodle plugin features. Static files (JS, CSS, images) are loaded via PHP loader, this prevents caching problems and it may improve performance. Original JavaScript based localisation files are not supported.

Subplugin Directory Structure

Here we show what directorys you can find in a Moodle specific TinyMCE plugin (/lib/editor/tinymce/plugins/name_of_your_plugin):

/db/*  Installation, upgrades, events, etc. It is not recommended to use database tables in these plugins.

/lang/yourplugin/tinymce_yourplugin.php  Language strings. All strings used from TinyMCE JavaScript files must start with "yourplugin:*" prefix.

/tinymce/editor_plugin.js  The actual TinyMCE plugin code.

/tinymce/*  Static files used from plugin code. Use tinyMCE.baseURL for links pointing to upstream TinyMCE code. Use ed.getParam("moodle_plugin_base") when referencing non-static plugin files.

/lib.php  Moodle plugin code, it has to contain at least tinymce_yourplugin class with update_init_params() method.

/settings.php  Moodle plugin settings (optional).

/version.php  Moodle plugin version (required).

/*  Other PHP scripts used by plugin.

What are the minimum files needed to start a Moodle specific TinyMCE plugin?

...