From c84835794a2e5665a2c51b4702432f37f01154d3 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Mon, 17 Apr 2023 17:45:51 +0200 Subject: [PATCH] Move the helper method for dark mode sensitive variables --- .../files/lib/acp/form/StyleEditForm.class.php | 17 +---------------- .../files/lib/data/style/Style.class.php | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/wcfsetup/install/files/lib/acp/form/StyleEditForm.class.php b/wcfsetup/install/files/lib/acp/form/StyleEditForm.class.php index 05429c2db4..cacdf0f756 100644 --- a/wcfsetup/install/files/lib/acp/form/StyleEditForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/StyleEditForm.class.php @@ -87,7 +87,7 @@ class StyleEditForm extends StyleAddForm // the actual stylesheet when saving. if ($this->style->hasDarkMode) { $variables = $this->style->getVariables(); - $supportsDarkMode = $this->getVariablesWithDarkModeSupport(); + $supportsDarkMode = Style::getVariablesWithDarkModeSupport(); if ($this->isDarkMode) { foreach ($this->variables as $key => $value) { if (\in_array($key, $supportsDarkMode, true)) { @@ -149,21 +149,6 @@ class StyleEditForm extends StyleAddForm } } - /** - * @since 6.0 - * @return string[] - */ - private function getVariablesWithDarkModeSupport(): array - { - $sql = "SELECT variableName - FROM wcf1_style_variable - WHERE defaultValueDarkMode IS NOT NULL"; - $statement = WCF::getDB()->prepare($sql); - $statement->execute(); - - return $statement->fetchAll(\PDO::FETCH_COLUMN); - } - /** * @inheritDoc */ diff --git a/wcfsetup/install/files/lib/data/style/Style.class.php b/wcfsetup/install/files/lib/data/style/Style.class.php index dec198ffe3..58fae9b44c 100644 --- a/wcfsetup/install/files/lib/data/style/Style.class.php +++ b/wcfsetup/install/files/lib/data/style/Style.class.php @@ -476,4 +476,19 @@ class Style extends DatabaseObject return $preset . "/* WCF_STYLE_CUSTOM_USER_MODIFICATIONS */\n" . $custom; } + + /** + * @since 6.0 + * @return string[] + */ + public static function getVariablesWithDarkModeSupport(): array + { + $sql = "SELECT variableName + FROM wcf1_style_variable + WHERE defaultValueDarkMode IS NOT NULL"; + $statement = WCF::getDB()->prepare($sql); + $statement->execute(); + + return $statement->fetchAll(\PDO::FETCH_COLUMN); + } } -- 2.20.1