]> _ Git - fluidbook-toolbox.git/commitdiff
wait #6534 @0.5
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Wed, 29 Nov 2023 11:34:41 +0000 (12:34 +0100)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Wed, 29 Nov 2023 11:34:41 +0000 (12:34 +0100)
app/Fluidbook/Compiler/Compiler.php
app/Models/FluidbookTheme.php

index ad6a186eb316047a88602799f5e78bd9faf4e6a7..3551bbb753ab70bba7f19c7426495b3834b374f7 100644 (file)
@@ -928,7 +928,7 @@ class Compiler extends Base implements CompilerInterface, IVirtualDirectoryError
             } else {
                 $credits = '';
             }
-            $bgcolor = $this->themeSettings->loadingBackColor;
+            $bgcolor = $this->theme->getLoadingBackgroundColor();
 
             // Feuilles de style
             $sheets = array_merge($this->stylesheets, $this->specialCSS);
index 3c944d2cc2108b2285eba55cbcf38091b4e745a4..e03e5d2a08009f81e80ce4ba773ec5b4b04dc083 100644 (file)
@@ -17,6 +17,7 @@ use Cubist\Backpack\Magic\Fields\SelectFromArray;
 use Cubist\Backpack\Magic\Fields\SelectFromModel;
 use Cubist\Util\CommandLine;
 use Cubist\Util\CommandLine\Imagemagick\Ico;
+use SplFileInfo;
 
 // __('!!Paramètres des thèmes')
 class FluidbookTheme extends ToolboxModel
@@ -56,6 +57,7 @@ class FluidbookTheme extends ToolboxModel
     protected $_operations = [ChangeownerOperation::class];
 
     use ToolboxSettings;
+
     public function setFields()
     {
         parent::setFields();
@@ -910,6 +912,32 @@ class FluidbookTheme extends ToolboxModel
         return $this->_settingsData;
     }
 
+    public function getLoadingBackgroundColor()
+    {
+        if ($this->hasAsset('backgroundImage')) {
+            return $this->getSettings()->get('loadingBackColor');
+        }
+
+        return \Cubist\Util\Graphics\Color::colorToCSS($this->getSettings()->get('backgroundColor'));
+    }
+
+    public function hasAsset($key)
+    {
+        $collection = $this->{$key};
+
+        if ($collection) {
+            $path = $this->getFirstMediaPath($collection);
+            if (!$path || !file_exists($path)) {
+                $res = false;
+            } else {
+                $res = new SplFileInfo($path);
+            }
+        } else {
+            $res = false;
+        }
+        return $res;
+    }
+
     public static function hashThemeArray($a)
     {
         if (!$a) {