GravityView  2.1.1
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  * @global GravityView_Widget_Search $this
7  */
8 
10 
11 $view_id = $gravityview_view->getViewId();
12 
13 $has_inputs = false;
14 
16 
17 ?>
18 
19 <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() ); ?>" data-viewid="<?php echo $view_id; ?>">
20 
21  <?php
22 
23  /**
24  * @action `gravityview_search_widget_fields_before` Inside the `<form>` tag of the GravityView search form, before inputs are rendered
25  * @param GravityView_Widget_Search $this GravityView Widget instance
26  */
27  do_action( 'gravityview_search_widget_fields_before', $this );
28 
29  foreach( $this->search_fields as $search_field ) {
30 
31  /**
32  * @action `gravityview_search_widget_field_before` Before each search input is rendered (other than the submit button)
33  * @param GravityView_Widget_Search $this GravityView Widget instance
34  * @param array $search_field
35  */
36  do_action( 'gravityview_search_widget_field_before', $this, $search_field );
37 
38  $gravityview_view->search_field = $search_field;
39  $this->render( 'search-field', $search_field['input'], false );
40 
41  // show/hide the search button if there are input type fields
42  if( !$has_inputs && $search_field['input'] != 'link' ) {
43  $has_inputs = true;
44  }
45 
46  /**
47  * @action `gravityview_search_widget_field_after` After each search input is rendered (other than the submit button)
48  * @param GravityView_Widget_Search $this GravityView Widget instance
49  * @param array $search_field
50  */
51  do_action( 'gravityview_search_widget_field_after', $this, $search_field );
52  }
53 
54  /**
55  * @action `gravityview_search_widget_fields_after` Inside the `<form>` tag of the GravityView search form, after inputs are rendered
56  * @param GravityView_Widget_Search $this GravityView Widget instance
57  */
58  do_action( 'gravityview_search_widget_fields_after', $this );
59 
60  if( $has_inputs ) {
61  $this->render( 'search-field', 'submit', false );
62  }
63 ?>
64 </form>
static getInstance( $passed_post=NULL)
$search_method
$view_id
$has_inputs
$gravityview_view
Display the Search widget.