on prend en compte si la cle options est presente

This commit is contained in:
Christophe 2022-05-12 10:07:09 +02:00
parent de77a13cb2
commit 064789956c

View file

@ -89,11 +89,17 @@ function gamuform_recup_tableau_objet(string $objet, bool $all = true):array {
$T = array_filter($T, function($d){
return !empty($d);
});
$options = [];
if (!empty($T['options'])) {
$options = $T['options'];
unset($T['options']);
}
if (!$all) {
$T = array_filter($T, function($d){
return !empty($d['saisie']);
});
$T = array_merge(['options' => $options], $T);
}
return $T;
}
@ -154,16 +160,17 @@ function gamuform_recup_champs_gamutable(string $objet):array {
*/
function gamuform_recup_champs_saisies(string $objet):array {
$c = [];
if (gamuform_objet_autoriser($objet)) {
$T = gamuform_recup_tableau_objet($objet, false);
if (array_key_exists('options', $T)) {
unset($T['options']);
}
if (!empty($T)) {
foreach ($T as $s) {
$c[] = $s['options']['nom'];
}
}
}
return $c;
}