GravityView  1.19.4
The best, easiest way to display Gravity Forms entries on your website.
widget-search.php
Go to the documentation of this file.
1 <?php
2 /**
3  * Display the Search widget
4  *
5  * @see class-search-widget.php
6  */
7 
9 
10 $view_id = $gravityview_view->getViewId();
11 
12 $has_inputs = false;
13 
15 
16 ?>
17 
18 <form class="gv-widget-search <?php echo GravityView_Widget_Search::get_search_class(); ?>" method="<?php echo $search_method; ?>" action="<?php echo esc_url( GravityView_Widget_Search::get_search_form_action() ); ?>">
19 
20  <?php
21 
22  /**
23  * @action `gravityview_search_widget_fields_before` Inside the `<form>` tag of the GravityView search form, before inputs are rendered
24  * @param GravityView_Widget_Search $this GravityView Widget instance
25  */
26  do_action( 'gravityview_search_widget_fields_before', $this );
27 
28  foreach( $this->search_fields as $search_field ) {
29  $gravityview_view->search_field = $search_field;
30  $this->render( 'search-field', $search_field['input'], false );
31 
32  // show/hide the search button if there are input type fields
33  if( !$has_inputs && $search_field['input'] != 'link' ) {
34  $has_inputs = true;
35  }
36  }
37 
38  /**
39  * @action `gravityview_search_widget_fields_after` Inside the `<form>` tag of the GravityView search form, after inputs are rendered
40  * @param GravityView_Widget_Search $this GravityView Widget instance
41  */
42  do_action( 'gravityview_search_widget_fields_after', $this );
43 
44  if( $has_inputs ) { ?>
45  <div class="gv-search-box gv-search-box-submit">
46  <?php
47 
48  // Output the Clear button, if enabled
50 
51  ?>
52  <input type="hidden" name="mode" value="<?php echo esc_attr( $gravityview_view->search_mode ); ?>" />
53  <input type="submit" class="button gv-search-button" id="gv_search_button_<?php echo $view_id; ?>" value="<?php esc_attr_e( 'Search', 'gravityview' ); ?>" />
54  </div>
55  <?php } ?>
56 </form>
$search_method
$view_id
$has_inputs
static getInstance($passed_post=NULL)
$gravityview_view
Display the Search widget.
static the_clear_search_button()
Output the Clear Search Results button.