We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
gpcc-copy-to-conditionally-hidden-fields.php
1 parent be2a8dc commit dc14dbdCopy full SHA for dc14dbd
gp-copy-cat/gpcc-copy-to-conditionally-hidden-fields.php
@@ -47,13 +47,14 @@
47
}
48
49
50
- if ( is_array( $source_values ) ) {
51
- foreach ( $source_values as $input_id => $source_value ) {
52
- $target_input_id = "{$target['target']}.{$input_id}";
53
- $entry[ $target_input_id ] = $source_value;
+ $values = is_array( $source_values ) ? array_values( $source_values ) : [ $source_values ];
+
+ foreach ( $values as $index => $value ) {
+ $target_input_id = is_array( $source_values ) ? "{$target['target']}." . ( $index + 1 ) : $target['target'];
54
+ $entry[ $target_input_id ] = $value;
55
+ if ( ! is_array( $source_values ) ) {
56
+ break;
57
- } else {
- $entry[ $target['target'] ] = $source_values;
58
59
60
0 commit comments