From 755db23dd0ab91a84679eedc17e03380f87144b9 Mon Sep 17 00:00:00 2001 From: fredtempez Date: Thu, 31 Oct 2019 22:36:18 +0100 Subject: [PATCH] [10.0.58.dev] homepage ok --- core/core.php | 21 +++++++++++++++++++-- core/module/page/page.php | 7 +------ 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/core/core.php b/core/core.php index 98d6482f..97135f8b 100644 --- a/core/core.php +++ b/core/core.php @@ -31,7 +31,7 @@ class common { const TEMP_DIR = 'site/tmp/'; // Numéro de version - const ZWII_VERSION = '10.0.57.dev'; + const ZWII_VERSION = '10.0.58.dev'; public static $actions = []; public static $coreModuleIds = [ @@ -483,7 +483,6 @@ class common { * @return string */ public function getHomePageId () { - $hierarchy = $this->getHierarchy(null, true); foreach($this->getHierarchy(null, null, null) as $parentPageId => $childrenPageIds) { if ($this->getData(['page',$parentPageId,"homePageId"]) === true) { return ($parentPageId); @@ -496,6 +495,24 @@ class common { } } + /** + * Retourne l'Id de la homePage de la langue courante + * @return string + */ + public function resetHomePageId () { + foreach($this->getHierarchy(null, null, null) as $parentPageId => $childrenPageIds) { + if ($this->getData(['page',$parentPageId,"homePageId"]) === true) { + $this->setData(['page',$parentPageId,"homePageId", false]); + } + foreach($childrenPageIds as $childKey) { + if ($this->getData(['page',$childKey,"homePageId"]) === true) { + $this->setData(['page',$childKey,"homePageId", false]); + } + } + } + } + + /** * Accède à une valeur des variables http (ordre de recherche en l'absence de type : _COOKIE, _POST) * @param string $key Clé de la valeur diff --git a/core/module/page/page.php b/core/module/page/page.php index 048276af..95d7bfc4 100755 --- a/core/module/page/page.php +++ b/core/module/page/page.php @@ -241,12 +241,7 @@ class page extends common { } // Reset homePage if ($this->getinput('pageHomePageId', helper::FILTER_BOOLEAN) === true ) { - foreach ($hierarchy as $hierarchyPageId) { - $this->setData(['page',$hierarchyPageId,"homePageId", false]); - foreach ($hierarchyPageId as $childId) { - $this->setData(['page',$childId,"homePageId", false]); - } - } + $this->resetHomePageId(); } // Modifie la page ou en crée une nouvelle si l'id a changé $this->setData([