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()
|
public static function getEnabled()
|
||||||
{
|
{
|
||||||
if (!isset(self::$current_enabled)) {
|
if (isset(static::$current_enabled)) {
|
||||||
self::$current_enabled = ContentNegotiator::config()->get('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)
|
public static function setEnabled($enabled)
|
||||||
{
|
{
|
||||||
if (isset($enabled)) {
|
static::$current_enabled = $enabled;
|
||||||
self::$current_enabled = $enabled;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace SilverStripe\Forms\HTMLEditor;
|
namespace SilverStripe\Forms\HTMLEditor;
|
||||||
|
|
||||||
|
use SilverStripe\Core\Config\Config;
|
||||||
use SilverStripe\Core\Config\Configurable;
|
use SilverStripe\Core\Config\Configurable;
|
||||||
use SilverStripe\Core\Injector\Injectable;
|
use SilverStripe\Core\Injector\Injectable;
|
||||||
|
|
||||||
@ -109,10 +110,10 @@ abstract class HTMLEditorConfig
|
|||||||
*/
|
*/
|
||||||
public static function getThemes()
|
public static function getThemes()
|
||||||
{
|
{
|
||||||
if (!isset(self::$current_themes)) {
|
if (isset(static::$current_themes)) {
|
||||||
self::$current_themes = self::config()->get('user_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)
|
public static function setThemes($themes)
|
||||||
{
|
{
|
||||||
if (isset($themes)) {
|
static::$current_themes = $themes;
|
||||||
self::$current_themes = $themes;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -244,7 +244,7 @@ class SSViewer implements Flushable
|
|||||||
*/
|
*/
|
||||||
public static function set_themes($themes = [])
|
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();
|
$currentThemes = SSViewer::get_themes();
|
||||||
$finalThemes = array_merge($themes, $currentThemes);
|
$finalThemes = array_merge($themes, $currentThemes);
|
||||||
// array_values is used to ensure sequential array keys as array_unique can leave gaps
|
// 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
|
// Explicit list is assigned
|
||||||
if ($list = SSViewer::config()->uninherited('themes')) {
|
$themes = static::$current_themes;
|
||||||
return $list;
|
if (!isset($themes)) {
|
||||||
|
$themes = SSViewer::config()->uninherited('themes');
|
||||||
|
}
|
||||||
|
if ($themes) {
|
||||||
|
return $themes;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Support legacy behaviour
|
// Support legacy behaviour
|
||||||
@ -384,8 +388,8 @@ class SSViewer implements Flushable
|
|||||||
public static function getRewriteHashLinksDefault()
|
public static function getRewriteHashLinksDefault()
|
||||||
{
|
{
|
||||||
// Check if config overridden
|
// Check if config overridden
|
||||||
if (isset(self::$current_rewrite_hash_links)) {
|
if (isset(static::$current_rewrite_hash_links)) {
|
||||||
return self::$current_rewrite_hash_links;
|
return static::$current_rewrite_hash_links;
|
||||||
}
|
}
|
||||||
return Config::inst()->get(static::class, '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)
|
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()
|
public function dontRewriteHashlinks()
|
||||||
{
|
{
|
||||||
$this->setRewriteHashLinks(false);
|
return $this->setRewriteHashLinks(false);
|
||||||
return $this;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user