GravityView
2.17
The best, easiest way to display Gravity Forms entries on your website.
includes
widgets
search-widget
templates
widget-search.php
Go to the documentation of this file.
1
<?php
2
/**
3
* Display the Search widget
4
*
5
* @file class-search-widget.php See for usage
6
* @global GravityView_Widget_Search $this
7
*/
8
9
$gravityview_view
=
GravityView_View::getInstance
();
10
11
$view_id
=
$gravityview_view
->getViewId();
12
13
$has_inputs
=
false
;
14
15
$search_method
=
GravityView_Widget_Search::getInstance
()->get_search_method();
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
( array_merge( $this->search_fields, $this->permalink_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{key:string,label:string,value:string,type:string,choices: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>
GravityView_View\getInstance
static getInstance( $passed_post=NULL)
Definition:
class-template.php:195
GravityView_Widget_Search\getInstance
static getInstance()
Definition:
class-search-widget.php:135
$search_method
$search_method
Definition:
widget-search.php:15
$view_id
$view_id
Definition:
widget-search.php:11
$search_field
$search_field
Definition:
search-field-chainedselect.php:14
$has_inputs
$has_inputs
Definition:
widget-search.php:13
$gravityview_view
$gravityview_view
Definition:
widget-search.php:9