Move the helper method for dark mode sensitive variables
authorAlexander Ebert <ebert@woltlab.com>
Mon, 17 Apr 2023 15:45:51 +0000 (17:45 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Mon, 17 Apr 2023 15:45:51 +0000 (17:45 +0200)
wcfsetup/install/files/lib/acp/form/StyleEditForm.class.php
wcfsetup/install/files/lib/data/style/Style.class.php

index 05429c2db4a1189c273fd58e2ff451354ff8763d..cacdf0f756e788b72a04f633ad0ee6db7ae241db 100644 (file)
@@ -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
      */
index dec198ffe397f956d99b3cb892ecd613d5786f61..58fae9b44c843ec79d44bd3e44461b426aa60c52 100644 (file)
@@ -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);
+    }
 }