From 77db8816576b753ae4d66548edba4569033451d3 Mon Sep 17 00:00:00 2001 From: "vincent@cubedesigners.com" Date: Mon, 7 Mar 2022 16:22:20 +0000 Subject: [PATCH] wip #4211 @0.5 --- inc/ws/Metier/class.ws.parametres.php | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/inc/ws/Metier/class.ws.parametres.php b/inc/ws/Metier/class.ws.parametres.php index d6aab1b21..d08d99fff 100644 --- a/inc/ws/Metier/class.ws.parametres.php +++ b/inc/ws/Metier/class.ws.parametres.php @@ -326,7 +326,7 @@ class wsParametres extends cubeMetier implements Iterator '; foreach ($this->forms as $formname => $form) { if ($tab !== 'form') { - echo $this->generateV3Field(['name' => 'section_' . $formname, 'type' => 'FormSection', 'label' => '§!§'.$form['label'].'!§!']); + echo $this->generateV3Field(['name' => 'section_' . $formname, 'type' => 'FormSection', 'label' => '§!§' . $form['label'] . '!§!']); $_tab = $tab; } else { $_tab = $form['label']; @@ -351,12 +351,27 @@ class wsParametres extends cubeMetier implements Iterator $attributes['tab'] = '§!§' . $tab . '!§!'; } $res = " "; - $res .= '$this->addField(' . $this->_varexport($attributes, true) . ');'; + $res .= '$this->addField(\'' . addcslashes($attributes['name'], "'") . '\', ' . $attributes['type'] . '::class'; + if(isset($attributes['label']) && $attributes['label']){ + $res.=', ' . $attributes['label']; + } + unset($attributes['name']); + unset($attributes['type']); + unset($attributes['label']); + if (count($attributes)) { + $res .= ', ' . $this->_varexport($attributes, true); + } + $res .= ');'; $res .= "\n"; + $res = str_replace("'§!§", '__(\'', $res); $res = str_replace("!§!'", '\')', $res); + $res = preg_replace_callback('/§!§(.*)!§!/u', function ($matches) { + return '__(\'' . addcslashes($matches[1], "'") . '\')'; + }, $res); + return $res; } -- 2.39.5