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.

Methods

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

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

setOption($k, $v)

Set the value of one option

setOptions($a)

Set multiple options

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().

disablePlugins()

Enable one or several plugins. Will properly handle being passed a plugin that is already disabled

array
getPlugins()

No description

setButtonsForLine()

Totally re-set the buttons on a given line

addButtonsToLine()

Add buttons to the end of a line

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 {@link 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'

Parameters

$identifier

string - the identifier for the config set

Return Value

HtmlEditorConfig
  • the configuration object. This will be created if it does not yet exist for that identifier

static null set_active($identifier = null)

Set the currently active configuration object

Parameters

$identifier

string - the identifier for the config set

Return Value

null

static string get_active_identifier()

Get the currently active configuration identifier

Return Value

string
  • the active configuration identifier

static HtmlEditorConfig get_active()

Get the currently active configuration object

Return Value

HtmlEditorConfig
  • the active configuration object

static array get_available_configs_map()

Get the available configurations as a map of friendly_name to configuration name.

Return Value

array

mixed getOption($k)

Get the current value of an option

Parameters

$k

string - The key of the option to get

Return Value

mixed
  • The value of the specified option

HtmlEditorConfig setOption($k, $v)

Set the value of one option

Parameters

$k

string - The key of the option to set

$v

mixed - The value of the option to set

Return Value

HtmlEditorConfig

HtmlEditorConfig setOptions($a)

Set multiple options

Parameters

$a

array - The options to set, as keys and values of the array

Return Value

HtmlEditorConfig

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

Return Value

HtmlEditorConfig

array getPlugins()

Return Value

array

HtmlEditorConfig setButtonsForLine()

Totally re-set the buttons on a given line

Return Value

HtmlEditorConfig

HtmlEditorConfig addButtonsToLine()

Add buttons to the end of a line

Return Value

HtmlEditorConfig

bool insertButtonsBefore()

Insert buttons before the first occurance of another button

Return Value

bool
  • true if insertion occured, false if it did not (because the given button name was not found)

bool insertButtonsAfter()

Insert buttons after the first occurance of another button

Return Value

bool

True if insertion occured, false if it did not (because the given button name was not found)

null removeButtons()

Remove the first occurance of buttons

Return Value

null

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 {@link Requirements} system