mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Enhancement update set_themes to not update config
This commit is contained in:
parent
7e92b053f4
commit
90d0361a6c
@ -105,10 +105,10 @@ class ContentNegotiator
|
||||
*/
|
||||
public static function getEnabled()
|
||||
{
|
||||
if (!isset(self::$current_enabled)) {
|
||||
self::$current_enabled = ContentNegotiator::config()->get('enabled');
|
||||
if (isset(static::$current_enabled)) {
|
||||
return static::$current_enabled;
|
||||
}
|
||||
return self::$current_enabled;
|
||||
return Config::inst()->get(static::class, 'enabled');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -118,9 +118,7 @@ class ContentNegotiator
|
||||
*/
|
||||
public static function setEnabled($enabled)
|
||||
{
|
||||
if (isset($enabled)) {
|
||||
self::$current_enabled = $enabled;
|
||||
}
|
||||
static::$current_enabled = $enabled;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
namespace SilverStripe\Forms\HTMLEditor;
|
||||
|
||||
use SilverStripe\Core\Config\Config;
|
||||
use SilverStripe\Core\Config\Configurable;
|
||||
use SilverStripe\Core\Injector\Injectable;
|
||||
|
||||
@ -109,10 +110,10 @@ abstract class HTMLEditorConfig
|
||||
*/
|
||||
public static function getThemes()
|
||||
{
|
||||
if (!isset(self::$current_themes)) {
|
||||
self::$current_themes = self::config()->get('user_themes');
|
||||
if (isset(static::$current_themes)) {
|
||||
return static::$current_themes;
|
||||
}
|
||||
return self::$current_themes;
|
||||
return Config::inst()->get(static::class, 'user_themes');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -122,9 +123,7 @@ abstract class HTMLEditorConfig
|
||||
*/
|
||||
public static function setThemes($themes)
|
||||
{
|
||||
if (isset($themes)) {
|
||||
self::$current_themes = $themes;
|
||||
}
|
||||
static::$current_themes = $themes;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -244,7 +244,7 @@ class SSViewer implements Flushable
|
||||
*/
|
||||
public static function set_themes($themes = [])
|
||||
{
|
||||
SSViewer::config()->set('themes', $themes);
|
||||
static::$current_themes = $themes;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -257,7 +257,7 @@ class SSViewer implements Flushable
|
||||
$currentThemes = SSViewer::get_themes();
|
||||
$finalThemes = array_merge($themes, $currentThemes);
|
||||
// array_values is used to ensure sequential array keys as array_unique can leave gaps
|
||||
SSViewer::set_themes(array_values(array_unique($finalThemes)));
|
||||
static::set_themes(array_values(array_unique($finalThemes)));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -274,8 +274,12 @@ class SSViewer implements Flushable
|
||||
}
|
||||
|
||||
// Explicit list is assigned
|
||||
if ($list = SSViewer::config()->uninherited('themes')) {
|
||||
return $list;
|
||||
$themes = static::$current_themes;
|
||||
if (!isset($themes)) {
|
||||
$themes = SSViewer::config()->uninherited('themes');
|
||||
}
|
||||
if ($themes) {
|
||||
return $themes;
|
||||
}
|
||||
|
||||
// Support legacy behaviour
|
||||
@ -384,8 +388,8 @@ class SSViewer implements Flushable
|
||||
public static function getRewriteHashLinksDefault()
|
||||
{
|
||||
// Check if config overridden
|
||||
if (isset(self::$current_rewrite_hash_links)) {
|
||||
return self::$current_rewrite_hash_links;
|
||||
if (isset(static::$current_rewrite_hash_links)) {
|
||||
return static::$current_rewrite_hash_links;
|
||||
}
|
||||
return Config::inst()->get(static::class, 'rewrite_hash_links');
|
||||
}
|
||||
@ -397,7 +401,7 @@ class SSViewer implements Flushable
|
||||
*/
|
||||
public static function setRewriteHashLinksDefault($rewrite)
|
||||
{
|
||||
self::$current_rewrite_hash_links = $rewrite;
|
||||
static::$current_rewrite_hash_links = $rewrite;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -464,8 +468,7 @@ class SSViewer implements Flushable
|
||||
*/
|
||||
public function dontRewriteHashlinks()
|
||||
{
|
||||
$this->setRewriteHashLinks(false);
|
||||
return $this;
|
||||
return $this->setRewriteHashLinks(false);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user