mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-04 08:47:23 +08:00
fix multiselect field in settings
This commit is contained in:
parent
94f1860e1c
commit
a740e866fe
2 changed files with 3 additions and 3 deletions
|
@ -61,12 +61,12 @@ class SettingsListener
|
|||
case 'text':
|
||||
$settings[$key] = isset($rawData[$key]) ? sanitize_text_field($rawData[$key]) : '';
|
||||
break;
|
||||
case 'multiselect':
|
||||
case 'ppcp-multiselect':
|
||||
$values = isset($rawData[$key]) ? (array) $rawData[$key] : [];
|
||||
$valuesToSave = [];
|
||||
foreach ($values as $index => $rawValue) {
|
||||
$value = sanitize_text_field($rawValue);
|
||||
if (! in_array($value, $config['options'], true)) {
|
||||
if (! in_array($value, array_keys($config['options']), true)) {
|
||||
continue;
|
||||
}
|
||||
$valuesToSave[] = $value;
|
||||
|
|
|
@ -48,7 +48,7 @@ class SettingsRenderer
|
|||
name="%s"
|
||||
>%s</select>',
|
||||
implode(' ', $config['class']),
|
||||
$key,
|
||||
$key . '[]',
|
||||
implode('', $options)
|
||||
);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue