From 5aa19e26fc07d4988b7388788126fa085891f133 Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Wed, 29 Nov 2023 12:34:41 +0100 Subject: [PATCH] wait #6534 @0.5 --- app/Fluidbook/Compiler/Compiler.php | 2 +- app/Models/FluidbookTheme.php | 28 ++++++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/app/Fluidbook/Compiler/Compiler.php b/app/Fluidbook/Compiler/Compiler.php index ad6a186eb..3551bbb75 100644 --- a/app/Fluidbook/Compiler/Compiler.php +++ b/app/Fluidbook/Compiler/Compiler.php @@ -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); diff --git a/app/Models/FluidbookTheme.php b/app/Models/FluidbookTheme.php index 3c944d2cc..e03e5d2a0 100644 --- a/app/Models/FluidbookTheme.php +++ b/app/Models/FluidbookTheme.php @@ -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) { -- 2.39.5