Skip to content
Snippets Groups Projects
Commit 8ec55a55 authored by Marcin Kolanko's avatar Marcin Kolanko
Browse files

fix(Template): add support for array values

parent 72dfe57c
Branches
Tags
1 merge request!8Bugfix/select multiple
Pipeline #5197 passed
......@@ -2,7 +2,7 @@
/**
* @var \WPDesk\Forms\Field $field
* @var string $name_prefix
* @var string $value
* @var mixed $value
*/
?>
<select
......@@ -22,7 +22,7 @@
<?php foreach ( $field->get_possible_values() as $possible_value => $label ): ?>
<option
<?php if ( $possible_value === $value || (is_numeric($possible_value) && is_numeric($value) && (int) $possible_value === (int) $value )): ?>selected="selected"<?php endif; ?>
<?php if ( $possible_value === $value || (is_array($value) && in_array($possible_value, $value)) || (is_numeric($possible_value) && is_numeric($value) && (int) $possible_value === (int) $value )): ?>selected="selected"<?php endif; ?>
value="<?php echo esc_attr( $possible_value ); ?>"
><?php echo esc_html( $label ); ?></option>
<?php endforeach; ?>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment