From e00e62bbf67da1d1fec23037edc5738b3ec79243 Mon Sep 17 00:00:00 2001 From: efalcy <efalcy@afi-sa.fr> Date: Thu, 8 Oct 2015 12:06:30 +0200 Subject: [PATCH] dev #19211 : gam get url image : refacto multiinput configuration --- .../admin/controllers/ModulesController.php | 31 ++++++------------- 1 file changed, 9 insertions(+), 22 deletions(-) diff --git a/application/modules/admin/controllers/ModulesController.php b/application/modules/admin/controllers/ModulesController.php index 6f93cc8f1f7..4f41491cbe0 100644 --- a/application/modules/admin/controllers/ModulesController.php +++ b/application/modules/admin/controllers/ModulesController.php @@ -315,44 +315,31 @@ class Admin_ModulesController extends ZendAfi_Controller_Action { $enreg['onglets'][$type][$champ] = $valeur; } - if ($links_zones=$this->processLinksZones()) + if ($links_zones=$this->processZones('link')) $enreg['links_zones'] = $links_zones; - if ($thumbnail_fields = $this->processThumbnailFields()) + if ($thumbnail_fields = $this->processZones('thumbnail')) $enreg['thumbnail_fields'] = $thumbnail_fields; return $enreg; } - protected function processLinksZones() { - $links_zones = $this->_getParam('link_zone', []); - $links_urls = $this->_getParam('link_url', []); - $links_labels = $this->_getParam('link_label', []); + protected function processZones($zone_name) { + $links_zones = $this->_getParam($zone_name.'_zone', []); + $links_fields = $this->_getParam($zone_name.'_url', []); + if ($zone_name == 'link') + $links_labels = $this->_getParam('link_label', []); $packer = new Class_Profil_ConfigPacker(); for ($i = 0; $i < count($links_zones); $i++) { - if ('' == $links_zones[$i] && '' == $links_urls[$i] && '' == $links_labels[$i]) + if ('' == $links_zones[$i] && '' == $links_fields[$i]) continue; - $packer->add([$links_zones[$i], $links_urls[$i], $links_labels[$i]]); + $packer->add([$links_zones[$i], $links_fields[$i]]); } return $packer->pack(); - } - - - protected function processThumbnailFields() { - $thumbnail_zones = $this->_getParam('thumbnail_zone', []); - $thumbnail_fields = $this->_getParam('thumbnail_url', []); - - $packer = new Class_Profil_ConfigPacker(); - for ($i = 0; $i < count($thumbnail_zones); $i++) { - if ('' == $thumbnail_zones[$i] && '' == $thumbnail_fields[$i]) - continue; - $packer->add([$thumbnail_zones[$i], $thumbnail_fields[$i]]); - } - return $packer->pack(); } -- GitLab