]> _ Git - cubeextranet.git/commitdiff
wip #4211 @0.5
authorvincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Mon, 7 Mar 2022 16:22:20 +0000 (16:22 +0000)
committervincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Mon, 7 Mar 2022 16:22:20 +0000 (16:22 +0000)
inc/ws/Metier/class.ws.parametres.php

index d6aab1b21a4b73d7ebad5a8ed8595b6be108f2d5..d08d99fff690ccf8ceb635dde494b52162bf972f 100644 (file)
@@ -326,7 +326,7 @@ class wsParametres extends cubeMetier implements Iterator
     ';\r
         foreach ($this->forms as $formname => $form) {\r
             if ($tab !== 'form') {\r
-                echo $this->generateV3Field(['name' => 'section_' . $formname, 'type' => 'FormSection', 'label' => '§!§'.$form['label'].'!§!']);\r
+                echo $this->generateV3Field(['name' => 'section_' . $formname, 'type' => 'FormSection', 'label' => '§!§' . $form['label'] . '!§!']);\r
                 $_tab = $tab;\r
             } else {\r
                 $_tab = $form['label'];\r
@@ -351,12 +351,27 @@ class wsParametres extends cubeMetier implements Iterator
             $attributes['tab'] = '§!§' . $tab . '!§!';\r
         }\r
         $res = "    ";\r
-        $res .= '$this->addField(' . $this->_varexport($attributes, true) . ');';\r
+        $res .= '$this->addField(\'' . addcslashes($attributes['name'], "'") . '\', ' . $attributes['type'] . '::class';\r
+        if(isset($attributes['label']) && $attributes['label']){\r
+            $res.=', ' . $attributes['label'];\r
+        }\r
+        unset($attributes['name']);\r
+        unset($attributes['type']);\r
+        unset($attributes['label']);\r
+        if (count($attributes)) {\r
+            $res .= ', ' . $this->_varexport($attributes, true);\r
+        }\r
+        $res .= ');';\r
         $res .= "\n";\r
 \r
+\r
         $res = str_replace("'§!§", '__(\'', $res);\r
         $res = str_replace("!§!'", '\')', $res);\r
 \r
+        $res = preg_replace_callback('/§!§(.*)!§!/u', function ($matches) {\r
+            return '__(\'' . addcslashes($matches[1], "'") . '\')';\r
+        }, $res);\r
+\r
         return $res;\r
     }\r
 \r