From 9544c3305d6101a923c9d266914dbb7d6556a7a9 Mon Sep 17 00:00:00 2001 From: Fred Tempez Date: Tue, 14 Feb 2023 16:53:28 +0100 Subject: [PATCH] Fix css if page with module WIP --- core/core.php | 28 ++++++++++++++++------------ core/module/page/page.php | 4 ++-- 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/core/core.php b/core/core.php index f8ec7c75..f9efeb78 100644 --- a/core/core.php +++ b/core/core.php @@ -3003,12 +3003,13 @@ class core extends common ) and $access ) { + + $this->addOutput([ 'title' => $title, 'content' => $this->getPage($this->getUrl(0), self::$i18nContent) . - // Concatène avec les paramètres avancés. - $this->getData(['page', $this->getUrl(0), 'css']) . - $this->getData(['page', $this->getUrl(0), 'js']), + ($this->getData(['page', $this->getUrl(0), 'css']) === null ? '' : $this->getData(['page', $this->getUrl(0), 'css']) ). + ($this->getData(['page', $this->getUrl(0), 'js']) === null ? '' : $this->getData(['page', $this->getUrl(0), 'js']) ), 'metaDescription' => $this->getData(['page', $this->getUrl(0), 'metaDescription']), 'metaTitle' => $this->getData(['page', $this->getUrl(0), 'metaTitle']), 'typeMenu' => $this->getData(['page', $this->getUrl(0), 'typeMenu']), @@ -3016,15 +3017,16 @@ class core extends common 'disable' => $this->getData(['page', $this->getUrl(0), 'disable']), 'contentRight' => $this->getData(['page', $this->getUrl(0), 'barRight']) ? $this->getPage($this->getData(['page', $this->getUrl(0), 'barRight']), self::$i18nContent) . - $this->getData(['page', $this->getData(['page', $this->getUrl(0), 'barRight']), 'css']) . - $this->getData(['page', $this->getData(['page', $this->getUrl(0), 'barRight']), 'js']) + ($this->getData(['page', $this->getData(['page', $this->getUrl(0), 'barRight']), 'css']) == null ?'' : $this->getData(['page', $this->getData(['page', $this->getUrl(0), 'barRight']), 'css'])) . + ($this->getData(['page', $this->getData(['page', $this->getUrl(0), 'barRight']), 'js']) === null ? '' : $this->getData(['page', $this->getData(['page', $this->getUrl(0), 'barRight']), 'js'])) : '', 'contentLeft' => $this->getData(['page', $this->getUrl(0), 'barLeft']) ? $this->getPage($this->getData(['page', $this->getUrl(0), 'barLeft']), self::$i18nContent) . - $this->getData(['page', $this->getData(['page', $this->getUrl(0), 'barLeft']), 'css']) . - $this->getData(['page', $this->getData(['page', $this->getUrl(0), 'barLeft']), 'js']) + ($this->getData(['page', $this->getData(['page', $this->getUrl(0), 'barLeft']), 'css']) === null ? '' : $this->getData(['page', $this->getData(['page', $this->getUrl(0), 'barLeft']), 'css'])) . + ($this->getData(['page', $this->getData(['page', $this->getUrl(0), 'barLeft']), 'js']) === null ? '' : $this->getData(['page', $this->getData(['page', $this->getUrl(0), 'barLeft']), 'js'])) : '' ]); + } // Importe le module else { @@ -3043,13 +3045,15 @@ class core extends common 'iconUrl' => $this->getData(['page', $this->getUrl(0), 'iconUrl']), 'disable' => $this->getData(['page', $this->getUrl(0), 'disable']), 'contentRight' => $this->getData(['page', $this->getUrl(0), 'barRight']) - ? $this->getPage($this->getData(['page', $this->getUrl(0), 'barRight']), self::$i18nContent) - : '', + ? $this->getPage($this->getData(['page', $this->getUrl(0), 'barRight']), self::$i18nContent) + : '', 'contentLeft' => $this->getData(['page', $this->getUrl(0), 'barLeft']) - ? $this->getPage($this->getData(['page', $this->getUrl(0), 'barLeft']), self::$i18nContent) - : '' + ? $this->getPage($this->getData(['page', $this->getUrl(0), 'barLeft']), self::$i18nContent) + : '' ]); - $pageContent = $this->getPage($this->getUrl(0), self::$i18nContent); + $pageContent = $this->getPage($this->getUrl(0), self::$i18nContent) . + ($this->getData(['page', $this->getUrl(0), 'css']) === null ? '' : $this->getData(['page', $this->getUrl(0), 'css']) ). + ($this->getData(['page', $this->getUrl(0), 'js']) === null ? '' : $this->getData(['page', $this->getUrl(0), 'js']) ); } else { $moduleId = $this->getUrl(0); $pageContent = ''; diff --git a/core/module/page/page.php b/core/module/page/page.php index dae6717b..aee53002 100644 --- a/core/module/page/page.php +++ b/core/module/page/page.php @@ -563,7 +563,7 @@ class page extends common // Soumission du formulaire if ($this->isPost()) { // Supprime les balises styles si elles ont été saisies - $css = $this->getInput('pageCssEditorContent', null); + $css = $this->getInput('pageCssEditorContent') === null ? '': $this->getInput('pageCssEditorContent'); // Enregistre le CSS $this->setData([ 'page', $this->getUrl(2), 'css', @@ -594,7 +594,7 @@ class page extends common // Soumission du formulaire if ($this->isPost()) { // Supprime les balises scripts si elles ont été saisies - $js = $this->getInput('pageJsEditorContent', null); + $js = $this->getInput('pageJsEditorContent') === null ? '' : $this->getInput('pageJsEditorContent'); // Enregistre le JS $this->setData([ 'page', $this->getUrl(2), 'js',