From a14eb7de9b22f35b9daf77b399b94851357cabda Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Wed, 14 Feb 2024 11:33:23 +0100 Subject: [PATCH] wait #6726 @1.5 --- app/Fluidbook/Compiler/Compiler.php | 3 ++- app/Models/Traits/ToolboxSettings.php | 12 ++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/app/Fluidbook/Compiler/Compiler.php b/app/Fluidbook/Compiler/Compiler.php index cd12ffbba..84334f284 100644 --- a/app/Fluidbook/Compiler/Compiler.php +++ b/app/Fluidbook/Compiler/Compiler.php @@ -301,7 +301,7 @@ class Compiler extends Base implements CompilerInterface, IVirtualDirectoryError $this->phonegapVersion = self::getPhonegapVersion($phonegapVersion); $this->appcache = $appcache; $this->multiApp = $this->home = $home; - $this->devversion = $this->getFluidbook()->mobileLVersion; + $this->devversion = $this->getFluidbook()->version < 3 ? "dev" : $this->getFluidbook()->mobileLVersion; $this->scormVariant = $scormVariant; $this->hybrid = $hybrid; @@ -499,6 +499,7 @@ class Compiler extends Base implements CompilerInterface, IVirtualDirectoryError } $this->config = new Data(array_merge($this->fluidbookSettings->getRawData()['settings'], $this->themeSettings->getRawData())); + $this->config->pages = count($this->getFluidbook()->composition); $this->config->bookmarkDisablePages = ArrayUtil::parseRange($this->config->bookmarkDisablePages); $this->config->rasterizePages = ArrayUtil::parseRange($this->config->rasterizePages); diff --git a/app/Models/Traits/ToolboxSettings.php b/app/Models/Traits/ToolboxSettings.php index 4cca4ce1f..d1fcc806e 100644 --- a/app/Models/Traits/ToolboxSettings.php +++ b/app/Models/Traits/ToolboxSettings.php @@ -22,6 +22,18 @@ trait ToolboxSettings { if (null === $this->_settingsData) { $this->_settingsData = $this->getPageData(); + + $this->_settingsData->setOffsetPrefix('settings.'); + foreach ($this->getFields() as $field) { + if (!$field->getAttribute('fake') || $field->getAttribute('store_in') !== 'settings') { + continue; + } + if ($this->_settingsData->has($field->getName())) { + continue; + } + $this->_settingsData->set($field->getName(), $field->getAttribute('default')); + } + } return $this->_settingsData; } -- 2.39.5