HtmlEditorConfig
class HtmlEditorConfig (View source)
A PHP version of TinyMCE's configuration, to allow various parameters to be configured on a site or section basis
There can be multiple HtmlEditorConfig's, which should always be created / accessed using HtmlEditorConfig::get. You can then set the currently active config using set_active. Whichever config is active when HtmlEditorField#Field is called wins.
Properties
protected | $settings | Holder for all TinyMCE settings except plugins and buttons |
||
protected | $plugins | Holder list of enabled plugins |
||
protected | $buttons | Holder list of buttons, organised by line |
Methods
Get the HtmlEditorConfig object for the given identifier. This is a correct way to get an HtmlEditorConfig instance - do not call 'new'
Get the available configurations as a map of friendly_name to configuration name.
Enable one or several plugins. Will maintain unique list if already enabled plugin is re-passed. If passed in as a map of plugin-name to path, the plugin will be loaded by tinymce.PluginManager.load() instead of through tinyMCE.init().
Enable one or several plugins. Will properly handle being passed a plugin that is already disabled
Internal function for adding and removing buttons related to another button
Generate the JavaScript that will set TinyMCE's configuration:
- Parse all configurations into JSON objects to be used in JavaScript
- Includes TinyMCE and configurations using the Requirements system
Details
static HtmlEditorConfig
get($identifier = 'default')
Get the HtmlEditorConfig object for the given identifier. This is a correct way to get an HtmlEditorConfig instance - do not call 'new'
static null
set_active($identifier = null)
Set the currently active configuration object
static string
get_active_identifier()
Get the currently active configuration identifier
static HtmlEditorConfig
get_active()
Get the currently active configuration object
static array
get_available_configs_map()
Get the available configurations as a map of friendly_name to configuration name.
mixed
getOption($k)
Get the current value of an option
HtmlEditorConfig
setOption($k, $v)
Set the value of one option
HtmlEditorConfig
setOptions($a)
Set multiple options
HtmlEditorConfig
enablePlugins()
Enable one or several plugins. Will maintain unique list if already enabled plugin is re-passed. If passed in as a map of plugin-name to path, the plugin will be loaded by tinymce.PluginManager.load() instead of through tinyMCE.init().
Keep in mind that these externals plugins require a dash-prefix in their name.
HtmlEditorConfig
disablePlugins()
Enable one or several plugins. Will properly handle being passed a plugin that is already disabled
array
getPlugins()
No description
HtmlEditorConfig
setButtonsForLine()
Totally re-set the buttons on a given line
HtmlEditorConfig
addButtonsToLine()
Add buttons to the end of a line
protected bool
modifyButtons($name, $offset, $del = 0, $add = null)
Internal function for adding and removing buttons related to another button
bool
insertButtonsBefore()
Insert buttons before the first occurance of another button
bool
insertButtonsAfter()
Insert buttons after the first occurance of another button
null
removeButtons()
Remove the first occurance of buttons
static
require_js()
Generate the JavaScript that will set TinyMCE's configuration:
- Parse all configurations into JSON objects to be used in JavaScript
- Includes TinyMCE and configurations using the Requirements system