class TinyMCEConfig extends HTMLEditorConfig

Default configuration for HtmlEditor specific to tinymce

Traits

Provides extensions to this object to integrate it with standard config API methods.
A class that can be instantiated or replaced via DI

Config options

tinymce_lang array
base_dir string Location of module relative to BASE_DIR. This must contain the following dirs - plugins - themes - skins
editor_css array Extra editor.css file paths.

Methods

static Config_ForClass
config()

Get a configuration accessor for this class. Short hand for Config::inst()->get($this->class, .

mixed
stat(string $name) deprecated

Get inherited config value

mixed
uninherited(string $name)

Gets the uninherited value for the given config option

$this
set_stat(string $name, mixed $value) deprecated

Update the config value for a given property

static Injectable
create(array $args)

An implementation of the factory method, allows you to create an instance of a class

static Injectable
singleton(string $class = null)

Creates a class instance by the "singleton" design pattern.

get(string $identifier = null)

Get the HTMLEditorConfig object for the given identifier. This is a correct way to get an HTMLEditorConfig instance - do not call 'new'

set_config(string $identifier, HTMLEditorConfig $config = null)

Assign a new config, or clear existing, for the given identifier

static array
getThemes()

Gets the current themes, if it is not set this will fallback to config

static 
setThemes(array $themes)

Sets the current theme

static 
set_active_identifier(string $identifier)

Set the currently active configuration object. Note that the existing active config will not be renamed to the new identifier.

static string
get_active_identifier()

Get the currently active configuration identifier. Will fall back to default_config if unassigned.

get_active()

Get the currently active configuration object

set_active(HTMLEditorConfig $config)

Assigns the currently active config an explicit instance

static array
get_available_configs_map()

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

mixed
getOption(string $key)

Get the current value of an option

$this
setOption(string $key, mixed $value)

Set the value of one option

$this
setOptions(array $options)

Set multiple options. This does not merge recursively, but only at the top level.

array
getAttributes()

Associative array of data-attributes to apply to the underlying text-area

init()

Initialise the editor on the client side

array
getConfigSchemaData()

Provide additional schema data for the field this object configures

string
getTheme()

Get the theme

$this
setTheme(string $theme)

Set the theme name

$this
enablePlugins($plugin)

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

$this
disablePlugins($plugin)

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

array
getPlugins()

Gets the list of all enabled plugins as an associative array.

array
getInternalPlugins()

Get list of plugins without custom locations, which is the set of plugins which can be loaded via the standard plugin path, and could potentially be minified

array
getButtons()

Get all button rows, skipping empty rows

$this
setButtonsForLine($line, $buttons)

Totally re-set the buttons on a given line

$this
addButtonsToLine($line, $buttons)

Add buttons to the end of a line

bool
insertButtonsBefore($before, $buttons)

Insert buttons before the first occurance of another button

bool
insertButtonsAfter($after, $buttons)

Insert buttons after the first occurance of another button

removeButtons($buttons)

Remove the first occurance of buttons

string[]
getContentCSS()

Get list of resource paths to css files.

$this
setContentCSS(string[] $css)

Set explicit set of CSS resources to use for content_css option.

string
getScriptURL()

Generate gzipped TinyMCE configuration including plugins and languages.

static string
get_tinymce_lang()

Get the current tinyMCE language

string
getTinyMCEResourcePath()

Returns the full filesystem path to TinyMCE resources (which could be different from the original tinymce location in the module).

string
getTinyMCEResourceURL()

Get front-end url to tinymce resources

getTinyMCEResource()

Get resource root for TinyMCE, either as a string or ModuleResource instance Path will be relative to BASE_PATH if string.

getTinyMCEPath() deprecated

No description

Details

in Configurable at line 20
static Config_ForClass config()

Get a configuration accessor for this class. Short hand for Config::inst()->get($this->class, .

....).

Return Value

Config_ForClass

in Configurable at line 32
mixed stat(string $name) deprecated

deprecated 5.0 Use ->config()->get() instead

Get inherited config value

Parameters

string $name

Return Value

mixed

in Configurable at line 44
mixed uninherited(string $name)

Gets the uninherited value for the given config option

Parameters

string $name

Return Value

mixed

in Configurable at line 57
$this set_stat(string $name, mixed $value) deprecated

deprecated 5.0 Use ->config()->set() instead

Update the config value for a given property

Parameters

string $name
mixed $value

Return Value

$this

in Injectable at line 26
static Injectable create(array $args)

An implementation of the factory method, allows you to create an instance of a class

This method will defer class substitution to the Injector API, which can be customised via the Config API to declare substitution classes.

This can be called in one of two ways - either calling via the class directly, or calling on Object and passing the class name as the first parameter. The following are equivalent: $list = DataList::create('SiteTree'); $list = SiteTree::get();

Parameters

array $args

Return Value

Injectable

in Injectable at line 43
static Injectable singleton(string $class = null)

Creates a class instance by the "singleton" design pattern.

It will always return the same instance for this class, which can be used for performance reasons and as a simple way to access instance methods which don't rely on instance data (e.g. the custom SilverStripe static handling).

Parameters

string $class Optional classname to create, if the called class should not be used

Return Value

Injectable The singleton instance

in HTMLEditorConfig at line 78
static HTMLEditorConfig get(string $identifier = null)

Get the HTMLEditorConfig object for the given identifier. This is a correct way to get an HTMLEditorConfig instance - do not call 'new'

Parameters

string $identifier The identifier for the config set. If omitted, the active config is returned.

Return Value

HTMLEditorConfig The configuration object. This will be created if it does not yet exist for that identifier

in HTMLEditorConfig at line 98
static HTMLEditorConfig set_config(string $identifier, HTMLEditorConfig $config = null)

Assign a new config, or clear existing, for the given identifier

Parameters

string $identifier A specific identifier
HTMLEditorConfig $config Config to set, or null to clear

Return Value

HTMLEditorConfig The assigned config

in HTMLEditorConfig at line 113
static array getThemes()

Gets the current themes, if it is not set this will fallback to config

Return Value

array

in HTMLEditorConfig at line 126
static setThemes(array $themes)

Sets the current theme

Parameters

array $themes

in HTMLEditorConfig at line 137
static set_active_identifier(string $identifier)

Set the currently active configuration object. Note that the existing active config will not be renamed to the new identifier.

Parameters

string $identifier The identifier for the config set

in HTMLEditorConfig at line 148
static string get_active_identifier()

Get the currently active configuration identifier. Will fall back to default_config if unassigned.

Return Value

string The active configuration identifier

in HTMLEditorConfig at line 159
static HTMLEditorConfig get_active()

Get the currently active configuration object

Return Value

HTMLEditorConfig The active configuration object

in HTMLEditorConfig at line 171
static HTMLEditorConfig set_active(HTMLEditorConfig $config)

Assigns the currently active config an explicit instance

Parameters

HTMLEditorConfig $config

Return Value

HTMLEditorConfig The given config

in HTMLEditorConfig at line 183
static array get_available_configs_map()

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

Return Value

array

at line 338
mixed getOption(string $key)

Get the current value of an option

Parameters

string $key The key of the option to get

Return Value

mixed The value of the specified option

at line 346
$this setOption(string $key, mixed $value)

Set the value of one option

Parameters

string $key The key of the option to set
mixed $value The value of the option to set

Return Value

$this

at line 352
$this setOptions(array $options)

Set multiple options. This does not merge recursively, but only at the top level.

Parameters

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

Return Value

$this

at line 370
array getAttributes()

Associative array of data-attributes to apply to the underlying text-area

Return Value

array

at line 748
init()

Initialise the editor on the client side

at line 754
array getConfigSchemaData()

Provide additional schema data for the field this object configures

Return Value

array

at line 299
string getTheme()

Get the theme

Return Value

string

at line 310
$this setTheme(string $theme)

Set the theme name

Parameters

string $theme

Return Value

$this

at line 399
$this enablePlugins($plugin)

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.

Parameters

$plugin

Return Value

$this

See also

http://wiki.moxiecode.com/index.php/TinyMCE:API/tinymce.PluginManager/load If passing in a non-associative array, the plugin name should be located in the standard tinymce plugins folder. If passing in an associative array, the key of each item should be the plugin name. The value of each item is one of: - null - Will be treated as a stardard plugin in the standard location - relative path - Will be treated as a relative url - absolute url - Some url to an external plugin - An instance of ModuleResource object containing the plugin

at line 423
$this disablePlugins($plugin)

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

Parameters

$plugin

Return Value

$this

at line 442
array getPlugins()

Gets the list of all enabled plugins as an associative array.

Array keys are the plugin names, and values are potentially the plugin location, or ModuleResource object

Return Value

array

at line 454
array getInternalPlugins()

Get list of plugins without custom locations, which is the set of plugins which can be loaded via the standard plugin path, and could potentially be minified

Return Value

array

at line 471
array getButtons()

Get all button rows, skipping empty rows

Return Value

array

at line 484
$this setButtonsForLine($line, $buttons)

Totally re-set the buttons on a given line

Parameters

$line
$buttons

Return Value

$this

at line 501
$this addButtonsToLine($line, $buttons)

Add buttons to the end of a line

Parameters

$line
$buttons

Return Value

$this

at line 548
bool insertButtonsBefore($before, $buttons)

Insert buttons before the first occurance of another button

Parameters

$before
$buttons

Return Value

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

at line 567
bool insertButtonsAfter($after, $buttons)

Insert buttons after the first occurance of another button

Parameters

$after
$buttons

Return Value

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

at line 583
removeButtons($buttons)

Remove the first occurance of buttons

Parameters

$buttons

at line 692
string[] getContentCSS()

Get list of resource paths to css files.

Will default to editor_css config, as well as any themed editor.css files. Use setContentCSS() to override.

Return Value

string[]

at line 727
$this setContentCSS(string[] $css)

Set explicit set of CSS resources to use for content_css option.

Note: If merging with default paths, you should call getContentCSS() and merge prior to assignment.

Parameters

string[] $css Array of resource paths. Supports module prefix, e.g. silverstripe/admin:client/dist/styles/editor.css

Return Value

$this

at line 741
string getScriptURL()

Generate gzipped TinyMCE configuration including plugins and languages.

This ends up "pre-loading" TinyMCE bundled with the required plugins so that multiple HTTP requests on the client don't need to be made.

Return Value

string

Exceptions

Exception

at line 766
static string get_tinymce_lang()

Get the current tinyMCE language

Return Value

string Language

at line 785
string getTinyMCEResourcePath()

Returns the full filesystem path to TinyMCE resources (which could be different from the original tinymce location in the module).

Path will be absolute.

Return Value

string

Exceptions

Exception

at line 800
string getTinyMCEResourceURL()

Get front-end url to tinymce resources

Return Value

string

Exceptions

Exception

at line 816
ModuleResource|string getTinyMCEResource()

Get resource root for TinyMCE, either as a string or ModuleResource instance Path will be relative to BASE_PATH if string.

Return Value

ModuleResource|string

Exceptions

Exception

at line 832
getTinyMCEPath() deprecated

deprecated 4.0.0:5.0.0