Gestione setting multipli da query di estrazione
This commit is contained in:
parent
464fc2bab6
commit
e0ae1cd645
|
@ -176,6 +176,12 @@ class Settings
|
|||
|
||||
// Lista multipla
|
||||
elseif (preg_match("/multiple\[(.+?)\]/", $setting->tipo, $m)) {
|
||||
|
||||
//Gestisco il multiple da query
|
||||
if (strstr($setting->tipo,'query=')) {
|
||||
$value = str_replace(']', '', explode('[', $setting->tipo)[1]);
|
||||
$select_values = '"'.str_replace('"', '\"', $value).'"';
|
||||
}else{
|
||||
$values = explode(',', $m[1]);
|
||||
|
||||
$list = [];
|
||||
|
@ -185,9 +191,11 @@ class Settings
|
|||
'text' => $value,
|
||||
];
|
||||
}
|
||||
$select_values = json_encode($list);
|
||||
}
|
||||
|
||||
$result = '
|
||||
{[ "type": "select", "multiple": 1, "label": '.json_encode($setting->nome).', "readonly": "'.!$setting->editable.'", "name": "setting['.$setting->id.'][]", "values": '.json_encode($list).', "value": "'.$setting->valore.'", "required": "'.intval($required).'", "help": "'.$setting->help.'" ]}';
|
||||
{[ "type": "select", "multiple": 1, "label": '.json_encode($setting->nome).', "readonly": "'.!$setting->editable.'", "name": "setting['.$setting->id.'][]", "values": '.$select_values.', "value": "'.$setting->valore.'", "required": "'.intval($required).'", "help": "'.$setting->help.'" ]}';
|
||||
}
|
||||
|
||||
// Lista da query
|
||||
|
|
Loading…
Reference in New Issue