Version: current

# Class HtmlEditorConfig

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.

Package: forms\fields-formattedinput
Author: "Hamish Friedlander" <hamish@silverstripe.com>
Located at sapphire/forms/HtmlEditorConfig.php

## Methods summary

`public static `HtmlEditorConfig`` | # `get( mixed $identifier = 'default' )` Get the HtmlEditorConfig object for the given identifier. This is a correct way to get an HtmlEditorConfig instance - do not call 'new' Get the HtmlEditorConfig object for the given identifier. This is a correct way to get an HtmlEditorConfig instance - do not call 'new' #### Parameters $identifier $identifier string - the identifier for the config set #### Returns ``HtmlEditorConfig`` - the configuration object. This will be created if it does not yet exist for that identifier
`public static null` | # `set_active( mixed $identifier = null )` Set the currently active configuration object Set the currently active configuration object #### Parameters $identifier $identifier string - the identifier for the config set #### Returns `null` null
`public static `HtmlEditorConfig`` | # `get_active( )` Get the currently active configuration object Get the currently active configuration object #### Returns ``HtmlEditorConfig`` - the active configuration object
`public static array` | # `get_available_configs_map( )` Get the available configurations as a map of friendly_name to configuration name. Get the available configurations as a map of friendly_name to configuration name. #### Returns `array` array
`public mixed` | # `getOption( mixed $k )` Get the current value of an option Get the current value of an option #### Parameters $k $k string - The key of the option to get #### Returns `mixed` - The value of the specified option
`public mixed` | # `setOption( mixed $k, mixed $v )` Set the value of one option Set the value of one option #### Parameters $k $k string - The key of the option to set $v $v mixed - The value of the option to set #### Returns `mixed` - $v returned for chaining
`public null` | # `setOptions( mixed $a )` Set multiple options Set multiple options #### Parameters $a $a array - The options to set, as keys and values of the array #### Returns `null` null
`public mixed` | # `getOptions( )` get multiple options get multiple options #### Returns `mixed` $a array - The options to set, as keys and values of the array
`public null` | # `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. 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. #### Returns `null` null #### See http://wiki.moxiecode.com/index.php/TinyMCE:API/tinymce.PluginManager/load
`public null` | # `disablePlugins( )` Enable one or several plugins. Will properly handle being passed a plugin that is already disabled Enable one or several plugins. Will properly handle being passed a plugin that is already disabled #### Returns `null` null
`public Array` | # `getPlugins( )` #### Returns `Array` Array
`public null` | # `setButtonsForLine( )` Totally re-set the buttons on a given line Totally re-set the buttons on a given line #### Returns `null` null
`public null` | # `addButtonsToLine( )` Add buttons to the end of a line Add buttons to the end of a line #### Returns `null` null
`protected boolean` | # `modifyButtons( mixed $name, mixed $offset, mixed $del = 0, mixed $add = null )` Internal function for adding and removing buttons related to another button Internal function for adding and removing buttons related to another button #### Parameters $name $name string - the name of the button to modify $offset $offset integer - the offset relative to that button to perform an array_splice at - 0 for before $name, 1 for after $del $del integer - the number of buttons to remove at the position given by index(string) + offset $add $add mixed - an array or single item to insert at the position given by index(string) + offset, or null for no insertion #### Returns `boolean` - true if $name matched a button, false otherwise
`public boolean` | # `insertButtonsBefore( )` Insert buttons before the first occurance of another button Insert buttons before the first occurance of another button #### Returns `boolean` - true if insertion occured, false if it did not (because the given button name was not found)
`public boolean` | # `insertButtonsAfter( )` Insert buttons after the first occurance of another button Insert buttons after the first occurance of another button #### Returns `boolean` - true if insertion occured, false if it did not (because the given button name was not found)
`public null` | # `removeButtons( )` Remove the first occurance of buttons Remove the first occurance of buttons #### Returns `null` null
`public string` | # `generateJS( )` Generate the javascript that will set tinyMCE's configuration to that of the current settings of this object Generate the javascript that will set tinyMCE's configuration to that of the current settings of this object #### Returns `string` - the javascript

### Magic methods summary

## Properties summary

`public static array` | $configs | #
`public static mixed` | $current | #
`protected array` | $settings | # Holder for all TinyMCE settings _except_ plugins and buttons Holder for all TinyMCE settings _except_ plugins and buttons
`protected array` | $plugins | # Holder list of enabled plugins Holder list of enabled plugins
`protected array` | $buttons | # Holder list of buttons, organised by line Holder list of buttons, organised by line

[Raise a SilverStripe Framework issue/bug](https://github.com/silverstripe/silverstripe-framework/issues/new)
- [Raise a SilverStripe CMS issue/bug](https://github.com/silverstripe/silverstripe-cms/issues/new)
- Please use the Silverstripe Forums to ask development related questions. -