From b746700d0c9eb08c21dbb6e95dfd3f439d5947b5 Mon Sep 17 00:00:00 2001 From: Fred Tempez Date: Sun, 20 Sep 2020 17:53:50 +0200 Subject: [PATCH] Duplication du module de page --- core/module/page/page.php | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/core/module/page/page.php b/core/module/page/page.php index d11176b1..733d9d54 100644 --- a/core/module/page/page.php +++ b/core/module/page/page.php @@ -93,17 +93,30 @@ class page extends common { 'notification' => 'Suppression non autorisée' ]); } + // Duplication de la page $pageTitle = $this->getData(['page',$url[0],'title']); $pageId = helper::increment(helper::filter($pageTitle, helper::FILTER_ID), $this->getData(['page'])); $data = $this->getData([ 'page', $url[0] ]); + // Ecriture $this->setData (['page',$pageId,$data]); + $notification = 'La page a été dupliquée'; + // Duplication du module présent + if ($this->getData(['page',$url[0],'moduleId'])) { + $data = $this->getData([ + 'module', + $url[0] + ]); + // Ecriture + $this->setData (['module',$pageId,$data]); + $notification = 'La page et son module ont été dupliqués'; + } // Valeurs en sortie $this->addOutput([ 'redirect' => helper::baseUrl() . 'page/edit/' . $pageId, - 'notification' => 'Page dupliquée', + 'notification' => $notification, 'state' => true ]); }