From c81b84b02477db05e89803593b1b4e5520e333e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Tempez?= Date: Wed, 5 Oct 2022 07:20:18 +0200 Subject: [PATCH] =?UTF-8?q?param=20creation=20de=20la=20config=20par=20d?= =?UTF-8?q?=C3=A9faut?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- module/gallery/gallery.php | 10 +++++++--- module/gallery/ressource/defaultdata.php | 8 +++----- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/module/gallery/gallery.php b/module/gallery/gallery.php index 327a214c..080f5ff3 100644 --- a/module/gallery/gallery.php +++ b/module/gallery/gallery.php @@ -254,6 +254,7 @@ class gallery extends common { $content = str_replace('#legendHeight#',$this->getData(['module', $this->getUrl(0), 'theme', 'legendHeight']),$content ); $content = str_replace('#legendTextColor#',$this->getData(['module', $this->getUrl(0), 'theme', 'legendTextColor']),$content ); $content = str_replace('#legendBgColor#',$this->getData(['module', $this->getUrl(0), 'theme', 'legendBgColor']),$content ); + // Ecriture de la feuille de style file_put_contents(self::DATADIRECTORY . $this->getUrl(0) . '/theme.css' , $content . $themeCss); // Nom de la feuille de style @@ -261,9 +262,12 @@ class gallery extends common { } // Check la présence de la config - if ( $this->getData(['module', $this->getUrl(0), 'config']) === null ) { - require_once('module/gallery/ressource/defaultdata.php'); - $this->setData(['module', $this->getUrl(0), 'config', theme::$defaultData]); + require_once('module/gallery/ressource/defaultdata.php'); + if ( is_null($this->getData(['module', $this->getUrl(0), 'config', 'showUniqueGallery'])) + || is_null($this->getData(['module', $this->getUrl(0), 'config', 'backPosition'])) + || is_null($this->getData(['module', $this->getUrl(0), 'config', 'backAlign'])) + ) { + $this->setData(['module', $this->getUrl(0), 'config', theme::$defaultConfig]); } // Contenu vide de la galerie diff --git a/module/gallery/ressource/defaultdata.php b/module/gallery/ressource/defaultdata.php index e8745929..b0fb1593 100644 --- a/module/gallery/ressource/defaultdata.php +++ b/module/gallery/ressource/defaultdata.php @@ -16,12 +16,10 @@ class theme extends gallery { 'legendTextColor' => 'rgba(255, 255, 255, 1)', 'legendBgColor' => 'rgba(0, 0, 0, .6)' ]; - public static $defaultConfig = [ + public static $defaultData = [ "showUniqueGallery" => false, "backPosition" => "top", - "backAlign" => "center" - ]; - public static $defaultData = [ - 'versionData' => '3.0' + "backAlign" => "center", + 'versionData' => '3.0' ]; }