HTMLEditorConfig
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. The order of precendence for which config is used is (lowest to highest):
- default_config config setting
- Active config assigned
- Config name assigned to HTMLEditorField
- Config instance assigned to HTMLEditorField
Typically global config changes should set the active config.
The default config class can be changed via dependency injection to replace HTMLEditorConfig.
Traits
Config options
default_config | string | Name of default config. This will be ignored if $current is assigned a value. | |
user_themes | array | List of themes defined for the frontend |
Methods
Get a configuration accessor for this class. Short hand for Config::inst()->get($this->class, .
Gets the uninherited value for the given config option
An implementation of the factory method, allows you to create an instance of a class
Creates a class instance by the "singleton" design pattern.
Get the HTMLEditorConfig object for the given identifier. This is a correct way to get an HTMLEditorConfig instance - do not call 'new'
Assign a new config, or clear existing, for the given identifier
Gets the current themes, if it is not set this will fallback to config
Sets the current theme
Set the currently active configuration object. Note that the existing active config will not be renamed to the new identifier.
Get the currently active configuration identifier. Will fall back to default_config if unassigned.
Get the currently active configuration object
Get the available configurations as a map of friendly_name to configuration name.
Get the current value of an option
Set the value of one option
Set multiple options. This does not merge recursively, but only at the top level.
Associative array of data-attributes to apply to the underlying text-area
Initialise the editor on the client side
Provide additional schema data for the field this object configures
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, .
....).
in Configurable at line 32
mixed
stat(string $name)
deprecated
deprecated 5.0 Use ->config()->get() instead
Get inherited config value
in Configurable at line 44
mixed
uninherited(string $name)
Gets the uninherited value for the given config option
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
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();
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).
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'
at line 98
static HTMLEditorConfig
set_config(string $identifier, HTMLEditorConfig $config = null)
Assign a new config, or clear existing, for the given identifier
at line 113
static array
getThemes()
Gets the current themes, if it is not set this will fallback to config
at line 126
static
setThemes(array $themes)
Sets the current theme
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.
at line 148
static string
get_active_identifier()
Get the currently active configuration identifier. Will fall back to default_config if unassigned.
at line 159
static HTMLEditorConfig
get_active()
Get the currently active configuration object
at line 171
static HTMLEditorConfig
set_active(HTMLEditorConfig $config)
Assigns the currently active config an explicit instance
at line 183
static array
get_available_configs_map()
Get the available configurations as a map of friendly_name to configuration name.
at line 200
abstract mixed
getOption(string $key)
Get the current value of an option
at line 208
abstract $this
setOption(string $key, mixed $value)
Set the value of one option
at line 216
abstract $this
setOptions(array $options)
Set multiple options. This does not merge recursively, but only at the top level.
at line 223
abstract array
getAttributes()
Associative array of data-attributes to apply to the underlying text-area
at line 228
abstract
init()
Initialise the editor on the client side
at line 235
array
getConfigSchemaData()
Provide additional schema data for the field this object configures