mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
Allow editor themes to fall back safely
This commit is contained in:
parent
cddaaf1444
commit
92903d883e
@ -52,7 +52,10 @@ abstract class HTMLEditorConfig
|
|||||||
private static $default_config = 'default';
|
private static $default_config = 'default';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var List of themes defined for the frontend
|
* List of themes defined for the frontend
|
||||||
|
*
|
||||||
|
* @config
|
||||||
|
* @var array
|
||||||
*/
|
*/
|
||||||
private static $user_themes = [];
|
private static $user_themes = [];
|
||||||
|
|
||||||
@ -108,7 +111,7 @@ abstract class HTMLEditorConfig
|
|||||||
*/
|
*/
|
||||||
public static function get_active_identifier()
|
public static function get_active_identifier()
|
||||||
{
|
{
|
||||||
$identifier = self::$current ?: static::config()->default_config;
|
$identifier = self::$current ?: static::config()->get('default_config');
|
||||||
return $identifier;
|
return $identifier;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -152,15 +155,6 @@ abstract class HTMLEditorConfig
|
|||||||
return $configs;
|
return $configs;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Set user defined (non-admin) themes
|
|
||||||
* @param array $themes
|
|
||||||
*/
|
|
||||||
public static function set_user_themes($themes)
|
|
||||||
{
|
|
||||||
self::config()->set('user_themes', $themes);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the current value of an option
|
* Get the current value of an option
|
||||||
*
|
*
|
||||||
|
@ -616,8 +616,10 @@ class TinyMCEConfig extends HTMLEditorConfig
|
|||||||
|
|
||||||
// Add standard editor.css
|
// Add standard editor.css
|
||||||
$editor[] = $this->getAdminModule()->getResourceURL('client/dist/styles/editor.css');
|
$editor[] = $this->getAdminModule()->getResourceURL('client/dist/styles/editor.css');
|
||||||
|
|
||||||
// Themed editor.css
|
// Themed editor.css
|
||||||
$themedEditor = ThemeResourceLoader::inst()->findThemedCSS('editor', $this->config()->user_themes);
|
$themes = $this->config()->get('user_themes') ?: SSViewer::get_themes();
|
||||||
|
$themedEditor = ThemeResourceLoader::inst()->findThemedCSS('editor', $themes);
|
||||||
if ($themedEditor) {
|
if ($themedEditor) {
|
||||||
$editor[] = Director::absoluteURL($themedEditor, Director::BASE);
|
$editor[] = Director::absoluteURL($themedEditor, Director::BASE);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user