|
@@ -10,14 +10,14 @@ discard block |
|
|
block discarded – undo |
|
10
|
10
|
$search_field = $gravityview_view->search_field; |
|
11
|
11
|
|
|
12
|
12
|
// Make sure that there are choices to display |
|
13
|
|
-if( empty( $search_field['choices'] ) ) { |
|
|
13
|
+if ( empty( $search_field[ 'choices' ] ) ) { |
|
14
|
14
|
gravityview()->log->debug( 'search-field-select.php - No choices for field' ); |
|
15
|
15
|
return; |
|
16
|
16
|
} |
|
17
|
17
|
|
|
18
|
|
-if( is_array( $search_field['value'] ) ) { |
|
|
18
|
+if ( is_array( $search_field[ 'value' ] ) ) { |
|
19
|
19
|
gravityview()->log->debug( 'search-field-select.php - Array values passed; using first value.' ); |
|
20
|
|
- $search_field['value'] = reset( $search_field['value'] ); |
|
|
20
|
+ $search_field[ 'value' ] = reset( $search_field[ 'value' ] ); |
|
21
|
21
|
} |
|
22
|
22
|
|
|
23
|
23
|
/** |
|
@@ -26,19 +26,19 @@ discard block |
|
|
block discarded – undo |
|
26
|
26
|
* @param string $default_option Default: `—` (—) |
|
27
|
27
|
* @param string $field_type Field type: "select" or "multiselect" |
|
28
|
28
|
*/ |
|
29
|
|
-$default_option = apply_filters('gravityview/extension/search/select_default', '—', 'select' ); |
|
|
29
|
+$default_option = apply_filters( 'gravityview/extension/search/select_default', '—', 'select' ); |
|
30
|
30
|
|
|
31
|
31
|
?> |
|
32
|
32
|
<div class="gv-search-box gv-search-field-select"> |
|
33
|
|
- <?php if( ! gv_empty( $search_field['label'], false, false ) ) { ?> |
|
34
|
|
- <label for="search-box-<?php echo esc_attr( $search_field['name'] ); ?>"><?php echo esc_html( $search_field['label'] ); ?></label> |
|
|
33
|
+ <?php if ( ! gv_empty( $search_field[ 'label' ], false, false ) ) { ?> |
|
|
34
|
+ <label for="search-box-<?php echo esc_attr( $search_field[ 'name' ] ); ?>"><?php echo esc_html( $search_field[ 'label' ] ); ?></label> |
|
35
|
35
|
<?php } ?> |
|
36
|
36
|
<p> |
|
37
|
|
- <select name="<?php echo esc_attr( $search_field['name'] ); ?>" id="search-box-<?php echo esc_attr( $search_field['name'] ); ?>"> |
|
38
|
|
- <option value="" <?php gv_selected( '', $search_field['value'], true ); ?>><?php echo esc_html( $default_option ); ?></option> |
|
|
37
|
+ <select name="<?php echo esc_attr( $search_field[ 'name' ] ); ?>" id="search-box-<?php echo esc_attr( $search_field[ 'name' ] ); ?>"> |
|
|
38
|
+ <option value="" <?php gv_selected( '', $search_field[ 'value' ], true ); ?>><?php echo esc_html( $default_option ); ?></option> |
|
39
|
39
|
<?php |
|
40
|
|
- foreach( $search_field['choices'] as $choice ) : ?> |
|
41
|
|
- <option value="<?php echo esc_attr( $choice['value'] ); ?>" <?php gv_selected( esc_attr( $choice['value'] ), esc_attr( $search_field['value'] ), true ); ?>><?php echo esc_html( $choice['text'] ); ?></option> |
|
|
40
|
+ foreach ( $search_field[ 'choices' ] as $choice ) : ?> |
|
|
41
|
+ <option value="<?php echo esc_attr( $choice[ 'value' ] ); ?>" <?php gv_selected( esc_attr( $choice[ 'value' ] ), esc_attr( $search_field[ 'value' ] ), true ); ?>><?php echo esc_html( $choice[ 'text' ] ); ?></option> |
|
42
|
42
|
<?php endforeach; ?> |
|
43
|
43
|
</select> |
|
44
|
44
|
</p> |