HTMLEditorConfig
abstract 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. 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
Provides extensions to this object to integrate it with standard config API methods.
A class that can be instantiated or replaced via DI
Properties
static private string | $default_config | Name of default config. This will be ignored if $current is assigned a value. |
|
static private array | $user_themes | 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
static Config_ForClass
config()
Get a configuration accessor for this class. Short hand for Config::inst()->get($this->class, .....).
mixed
stat(string $name)
deprecated
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
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
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();
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).
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'
static HTMLEditorConfig
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.
static HTMLEditorConfig
get_active()
Get the currently active configuration object
static HTMLEditorConfig
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.
abstract mixed
getOption(string $key)
Get the current value of an option
abstract $this
setOption(string $key, mixed $value)
Set the value of one option
abstract $this
setOptions(array $options)
Set multiple options. This does not merge recursively, but only at the top level.
abstract array
getAttributes()
Associative array of data-attributes to apply to the underlying text-area
abstract
init()
Initialise the editor on the client side
array
getConfigSchemaData()
Provide additional schema data for the field this object configures