Support options with keys.

These changes are needed to add member directory filters
`WC Billing state` and `WC Shipping state`
This commit is contained in:
yuriinalivaiko
2021-08-12 18:32:23 +03:00
parent 8805d1fd6f
commit 270f8ef0f6
+3 -1
View File
@@ -133,7 +133,9 @@ if ( ! class_exists( 'um\core\Form' ) ) {
)
);
if ( ! empty( $values_array ) ) {
if ( 0 !== current( array_keys( $arr_options['items'] ) ) ) {
$arr_options['items'] = array_intersect_key( array_map( 'trim', $arr_options['items'] ), array_flip( $values_array ) );
} elseif ( ! empty( $values_array ) ) {
$arr_options['items'] = array_intersect( $arr_options['items'], $values_array );
} else {
$arr_options['items'] = array();