GravityView  1.19.4
The best, easiest way to display Gravity Forms entries on your website.
search-field-multiselect.php
Go to the documentation of this file.
1 <?php
2 /**
3  * Display the search MULTISELECT input field
4  *
5  * @see class-search-widget.php
6  */
7 
9 $view_id = $gravityview_view->getViewId();
11 
12 // Make sure that there are choices to display
13 if( empty( $search_field['choices'] ) ) {
14  do_action('gravityview_log_debug', 'search-field-multiselect.php - No choices for field' );
15  return;
16 }
17 
18 /**
19  * @filter `gravityview/extension/search/select_default` Define the text for the default option in a select (multi or single dropdown)
20  * @since 1.16.4
21  * @param string $default_option Default: `&mdash;` (—)
22  * @param string $field_type Field type: "select" or "multiselect"
23  */
24 $default_option = apply_filters('gravityview/extension/search/select_default', '&mdash;', 'multiselect' );
25 
26 ?>
27 <div class="gv-search-box gv-search-field-multiselect">
28  <?php if( ! gv_empty( $search_field['label'], false ) ) { ?>
29  <label for="search-box-<?php echo esc_attr( $search_field['name'] ); ?>"><?php echo esc_html( $search_field['label'] ); ?></label>
30  <?php } ?>
31  <p>
32  <select name="<?php echo esc_attr( $search_field['name'] ); ?>[]" id="search-box-<?php echo esc_attr( $search_field['name'] ); ?>" multiple>
33  <option value="" <?php gv_selected( '', $search_field['value'], true ); ?>><?php echo esc_html( $default_option ); ?></option>
34  <?php
35  foreach( $search_field['choices'] as $choice ) : ?>
36  <option value="<?php echo esc_attr( $choice['value'] ); ?>" <?php gv_selected( $choice['value'], $search_field['value'], true ); ?>><?php echo esc_html( $choice['text'] ); ?></option>
37  <?php endforeach; ?>
38  </select>
39  </p>
40 </div>
if(empty($search_field['choices'])) $default_option
gv_empty($value, $zero_is_empty=true, $allow_string_booleans=true)
Is the value empty?
$gravityview_view
Display the search MULTISELECT input field.
gv_selected($value, $current, $echo=true, $type= 'selected')
Similar to the WordPress selected(), checked(), and disabled() functions, except it allows arrays to ...
static getInstance($passed_post=NULL)