GravityView
2.17
The best, easiest way to display Gravity Forms entries on your website.
|
Public Member Functions | |
add_columns_sort_links ( $label='', $field=array(), $form=array()) | |
Inject the sorting links on the table columns. More... | |
add_scripts_and_styles () | |
Register styles and scripts. More... | |
comments_open ( $open, $post_id) | |
Disable comments on GravityView post types. More... | |
context_not_configured_warning ( $view_id=0) | |
Display a warning when a View has not been configured. More... | |
detect_views_in_block_content ( $block_content) | |
Detect GV Views in parsed Gutenberg block content. More... | |
filter_no_entries_output ( $no_entries_text, $is_search, $context=null) | |
Modify what happens when there are no entries in the View based on View settings. More... | |
get_context_view_id () | |
Returns the the view_id context when page contains multiple embedded views or displaying single entry view. More... | |
getEntry () | |
getGvOutputData () | |
getPostId () | |
getSingleEntry () | |
is_field_sortable ( $field_id='', $form=array()) | |
Checks if field (column) is sortable. More... | |
is_searching () | |
Checks if the current View is presenting search results. More... | |
isGravityviewPostType () | |
isPostHasShortcode () | |
isSearch () | |
parse_content ( $wp=array()) | |
Read the $post and process the View data inside. More... | |
parse_query_fix_frontpage (&$query) | |
Allow GravityView entry endpoints on the front page of a site. More... | |
set_context_view_id ( $view_id=null) | |
Set the context view ID used when page contains multiple embedded views or displaying the single entry view. More... | |
set_entry_data () | |
Set the entry. More... | |
setEntry ( $entry) | |
Set the current entry. More... | |
setGvOutputData ( $gv_output_data) | |
setIsGravityviewPostType ( $is_gravityview_post_type) | |
setIsSearch ( $is_search) | |
setPostHasShortcode ( $post_has_shortcode) | |
setPostId ( $post_id) | |
setSingleEntry ( $single_entry) | |
Sets the single entry ID and also the entry. More... | |
single_entry_title ( $passed_title, $passed_post_id=null) | |
Filter the title for the single entry view. More... | |
Static Public Member Functions | |
static | _override_sorting_id_by_field_type ( $sort_field_id, $form_id) |
Override sorting per field. More... | |
static | add_style ( $template_id) |
Add template extra style if exists. More... | |
static | get_search_criteria ( $args, $form_id) |
Parse search criteria for a entries search. More... | |
static | get_search_criteria_paging ( $args) |
Get the paging array for the View. More... | |
static | getInstance () |
Get the one true instantiated self. More... | |
insert_view_in_content ( $content) | |
In case View post is called directly, insert the view in the post content. More... | |
static | is_entry_approved ( $entry, $args=array()) |
Check if a certain entry is approved. More... | |
static | is_single_entry () |
Verify if user requested a single entry view. More... | |
static | process_search_dates ( $args, $search_criteria=array()) |
Process the start and end dates for a view - overrides values defined in shortcode (if needed) More... | |
static | process_search_only_approved ( $args, $search_criteria) |
Process the approved only search criteria according to the View settings. More... | |
render_view ( $passed_args) | |
Core function to render a View based on a set of arguments. More... | |
Data Fields | |
$context_view_id = null | |
$entry = false | |
$gv_output_data = null | |
$is_gravityview_post_type = false | |
$is_search = false | |
$post_has_shortcode = false | |
$post_id = null | |
$single_entry = false | |
Static Public Attributes | |
static | $instance |
Private Member Functions | |
__construct () | |
Class constructor, enforce Singleton pattern. More... | |
_get_single_entry_title ( $view, $entry=array(), $passed_title='') | |
Returns the single entry title for a View with variables replaced and shortcodes parsed. More... | |
enqueue_default_style ( $css_dependencies=array()) | |
Handle enqueuing the gravityview_default_style stylesheet. More... | |
initialize () | |
Static Private Attributes | |
static | $search_parameters = array( 'gv_search', 'gv_start', 'gv_end', 'gv_id', 'gv_by', 'filter_*' ) |
Definition at line 15 of file class-frontend-views.php.
|
private |
Class constructor, enforce Singleton pattern.
Definition at line 93 of file class-frontend-views.php.
|
private |
Returns the single entry title for a View with variables replaced and shortcodes parsed.
\GV\View | null | $view | |
array | $entry | |
string | $passed_title |
gravityview/single/title/check_entry_display
Override whether to check entry display rules against filters Definition at line 578 of file class-frontend-views.php.
References GV\$form, $title, GVCommon\check_entry_display(), GVCommon\get_form(), and GravityView_API\replace_variables().
Referenced by single_entry_title().
|
static |
Override sorting per field.
Currently only modifies sorting ID when sorting by the full name. Sorts by first name. Use the gravityview/sorting/full-name
filter to override.
Override how to sort when sorting address
string | $address_part | street , street2 , city , state , zip , or country (default: city ) |
string | $sort_field_id | Field used for sorting |
int | $form_id | GF Form ID |
gravityview/sorting/full-name
Override how to sort when sorting full name. string | $name_part | Sort by first or last (default: first ) |
string | $sort_field_id | Field used for sorting |
int | $form_id | GF Form ID |
gravityview/sorting/time
Override how to sort when sorting time string | $name_part | Field used for sorting |
int | $form_id | GF Form ID |
Definition at line 1346 of file class-frontend-views.php.
References GV\$form, $form_id, and gravityview_get_form().
Referenced by View_Table_Template\add_columns_sort_links(), and View\get_entries().
add_columns_sort_links | ( | $label = '' , |
|
$field = array() , |
|||
$form = array() |
|||
) |
Inject the sorting links on the table columns.
Callback function for hook 'gravityview/template/field_label'
string | $label | Field label. |
array | $field | Field settings. |
array | $form | Form object. |
Not a table-based template; don't add sort icons
Definition at line 1648 of file class-frontend-views.php.
References $class, $field, GV\$form, $label, $url, GravityView_View\getInstance(), and is_field_sortable().
add_scripts_and_styles | ( | ) |
Register styles and scripts.
gravity_view_lightbox_script
Override the lightbox script to enqueue. Default: thickbox
string | $script_slug | If you want to use a different lightbox script, return the name of it here. |
gravityview_lightbox_script
Override the lightbox script to enqueue. Default: thickbox
string | $script_slug | If you want to use a different lightbox script, return the name of it here. |
Definition at line 1483 of file class-frontend-views.php.
References $post, $view_id, View\by_id(), enqueue_default_style(), getGvOutputData(), GRAVITYVIEW_FILE, gravityview_get_template_id(), and GV_PLUGIN_VERSION.
|
static |
Add template extra style if exists.
string | $template_id |
Definition at line 1619 of file class-frontend-views.php.
References gravityview().
comments_open | ( | $open, | |
$post_id | |||
) |
Disable comments on GravityView post types.
boolean | $open | existing status |
int | $post_id | Post ID |
gravityview/comments_open
Whether to set comments to open or closed. boolean | $open | Open or closed status |
int | $post_id | Post ID to set comment status for |
Definition at line 637 of file class-frontend-views.php.
References isGravityviewPostType().
context_not_configured_warning | ( | $view_id = 0 | ) |
Display a warning when a View has not been configured.
int | $view_id | The ID of the View currently being displayed |
Definition at line 665 of file class-frontend-views.php.
References $image, $output, $title, $view_id, GVCommon\generate_notice(), GravityView_View\getInstance(), and GRAVITYVIEW_FILE.
detect_views_in_block_content | ( | $block_content | ) |
Detect GV Views in parsed Gutenberg block content.
string | $block_content | Gutenberg block content |
Definition at line 357 of file class-frontend-views.php.
References View_Collection\from_content(), and GravityView_View_Data\getInstance().
|
private |
Handle enqueuing the gravityview_default_style
stylesheet.
array | $css_dependencies | Dependencies for the gravityview_default_style stylesheet |
gravityview_use_legacy_search_css
Should GravityView use the legacy Search Bar stylesheet (from before Version 1.17)? bool | $use_legacy_search_style | If true, loads gv-legacy-search(-rtl).css . If false, loads gv-default-styles(-rtl).css . -rtl is added on RTL websites. Default: false |
Definition at line 1596 of file class-frontend-views.php.
References gravityview_css_url(), and GV_PLUGIN_VERSION.
Referenced by add_scripts_and_styles().
filter_no_entries_output | ( | $no_entries_text, | |
$is_search, | |||
$context = null |
|||
) |
Modify what happens when there are no entries in the View based on View settings.
string | $output | The existing 'No Entries' text. |
boolean | $is_search | Is the current page a search result, or just a multiple entries screen? |
\GV\Template_Context | null | $context | The context, if available. |
Definition at line 714 of file class-frontend-views.php.
get_context_view_id | ( | ) |
Returns the the view_id context when page contains multiple embedded views or displaying single entry view.
Definition at line 273 of file class-frontend-views.php.
References $context_view_id.
|
static |
Parse search criteria for a entries search.
array( 'search_field' => 1, // ID of the field 'search_value' => '', // Value of the field to search 'search_operator' => 'contains', // 'is', 'isnot', '>', '<', 'contains' 'show_only_approved' => 0 or 1 // Boolean )
array | $args | Array of args |
int | $form_id | Gravity Forms form ID |
status
key set to "active" by default, field_filters
array with key
, value
and operator
keys. Compatibility with filters hooking in gravityview_search_criteria
instead of gravityview_fe_search_criteria
.
gravityview_fe_search_criteria
Modify the search criteria array | $search_criteria | Empty field_filters key |
int | $form_id | ID of the Gravity Forms form that is being searched |
array | $args | The View settings. |
gravityview_status
Modify entry status requirements to be included in search results. string | $status | Default: active . Accepts all Gravity Forms entry statuses, including spam and trash |
Definition at line 991 of file class-frontend-views.php.
References $args, $criteria, $entries, $form_id, gravityview(), and GV\Mocks\GravityView_frontend_get_view_entries().
Referenced by GravityView_Bulk_Actions\process_bulk_action().
|
static |
Get the paging array for the View.
$args | ||
int | $form_id |
gravityview_default_page_size
The default number of entries displayed in a View int | $default_page_size | Default: 25 |
Definition at line 1205 of file class-frontend-views.php.
References $args, $field, GV\$form, $form_id, Utils\get(), GravityView_View\getInstance(), gravityview(), and GVCommon\is_field_numeric().
getEntry | ( | ) |
getGvOutputData | ( | ) |
Definition at line 132 of file class-frontend-views.php.
References $gv_output_data.
Referenced by add_scripts_and_styles(), and set_context_view_id().
|
static |
Get the one true instantiated self.
Definition at line 119 of file class-frontend-views.php.
Referenced by GravityView_Admin_Bar\__construct(), View_Table_Template\add_columns_sort_links(), GVCommon\calculate_get_entries_criteria(), GravityView_API\directory_link(), GravityView_API\entry_link(), GravityView_Theme_Hooks_WPML\filter_gravityview_back_link(), Legacy_Context\freeze(), GravityView_Entry_Link_Shortcode\get_entry(), get_gravityview(), GravityView_Widget_Search\get_search_class(), gravityview_get_current_view_data(), gravityview_get_current_views(), GravityView_Theme_Hooks_Church_Themes\if_gravityview_return_true(), is_field_sortable(), Renderer\maybe_print_notices(), Blocks\render_shortcode(), GravityView_Shortcode\shortcode(), and Legacy_Context\thaw().
getPostId | ( | ) |
Definition at line 199 of file class-frontend-views.php.
References $post_id.
Referenced by parse_content().
getSingleEntry | ( | ) |
Definition at line 160 of file class-frontend-views.php.
References $single_entry.
Referenced by is_searching().
|
private |
Definition at line 95 of file class-frontend-views.php.
|
static |
In case View post is called directly, insert the view in the post content.
mixed | $content |
Definition at line 625 of file class-frontend-views.php.
References $content, and gravityview().
|
static |
Check if a certain entry is approved.
If we pass the View settings ($args) it will check the 'show_only_approved' setting before checking the entry approved field, returning true if show_only_approved = false.
GravityView_Entry_Approval_Status::is_approved
array | $entry | Entry object |
array | $args | View settings (optional) |
Definition at line 959 of file class-frontend-views.php.
References $args, gravityview(), GVCommon\has_cap(), GravityView_Entry_Approval_Status\is_approved(), and GravityView_Entry_Approval\meta_key.
is_field_sortable | ( | $field_id = '' , |
|
$form = array() |
|||
) |
Checks if field (column) is sortable.
string | $field | Field settings |
array | $form | Gravity Forms form array |
2.14
gravityview/sortable/field_blocklist
Modify what fields should never be sortable. array | $not_sortable | Array of field types that aren't sortable. |
string | $field_type | Field type to check whether the field is sortable. |
array | $form | Gravity Forms form. |
Definition at line 1703 of file class-frontend-views.php.
References $field, $field_id, GV\$form, and getInstance().
Referenced by add_columns_sort_links().
is_searching | ( | ) |
Checks if the current View is presenting search results.
Definition at line 446 of file class-frontend-views.php.
References $search_method, GravityView_Widget_Search\getInstance(), and getSingleEntry().
Referenced by parse_content().
|
static |
Verify if user requested a single entry view.
Modify the entry that is being displayed.
Definition at line 1447 of file class-frontend-views.php.
References $single_entry, and Entry\get_endpoint_name().
Referenced by GravityView_Edit_Entry_Render\get_entry(), gravityview_is_single_entry(), and GravityView_Edit_Entry_Render\is_edit_entry().
isGravityviewPostType | ( | ) |
Definition at line 227 of file class-frontend-views.php.
References $is_gravityview_post_type.
Referenced by comments_open(), and parse_content().
isPostHasShortcode | ( | ) |
Definition at line 213 of file class-frontend-views.php.
References $post_has_shortcode.
isSearch | ( | ) |
parse_content | ( | $wp = array() | ) |
Read the $post and process the View data inside.
array | $wp | Passed in the wp hook. Not used. |
Definition at line 381 of file class-frontend-views.php.
References $post, GravityView_View_Data\getInstance(), getPostId(), gravityview(), gravityview_has_shortcode_r(), is_searching(), isGravityviewPostType(), set_context_view_id(), setGvOutputData(), setIsGravityviewPostType(), setIsSearch(), setPostHasShortcode(), and setPostId().
parse_query_fix_frontpage | ( | & | $query | ) |
Allow GravityView entry endpoints on the front page of a site.
Fixes this core issue https://wordpress.org/plugins/cpt-on-front-page/ Code is based on this 1.17.3 WP_Query &$query (passed by reference) void
Definition at line 289 of file class-frontend-views.php.
References Utils\get().
|
static |
Process the start and end dates for a view - overrides values defined in shortcode (if needed)
The start_date
and end_date
keys need to be in a format processable by GFFormsModel::get_date_range_where(), which uses () format.
You can set the start_date
or end_date
to any value allowed by strtotime(), including strings like "now" or "-1 year" or "-3 days".
array | $args | View settings |
array | $search_criteria | Search being performed, if any |
$search_criteria
array If the end date is formatted as 'Y-m-d', it should be formatted without hours and seconds so that Gravity Forms can convert the day to 23:59:59 the previous day.
If it's a relative date ("now" or "-1 day"), then it should use the precise date format
Definition at line 839 of file class-frontend-views.php.
References $args, and gravityview().
|
static |
Process the approved only search criteria according to the View settings.
array | $args | View settings |
array | $search_criteria | Search being performed, if any |
$search_criteria
array Definition at line 919 of file class-frontend-views.php.
References $args, GravityView_Entry_Approval_Status\APPROVED, gravityview(), GVCommon\has_cap(), and GravityView_Entry_Approval\meta_key.
|
static |
Core function to render a View based on a set of arguments.
array | $passed_args | { Settings for rendering the View @type int $id View id @type int $page_size Number of entries to show per page @type string $sort_field Form field id to sort @type string $sort_direction Sorting direction ('ASC', 'DESC', or 'RAND') @type string $start_date - Ymd @type string $end_date - Ymd @type string $class - assign a html class to the view @type string $offset (optional) - This is the start point in the current data set (0 index based).} |
We can use a shortcode here, since it's pretty much the same.
But we do need to check embed permissions, since shortcodes don't do this.
Definition at line 798 of file class-frontend-views.php.
References gravityview(), and GVCommon\has_cap().
set_context_view_id | ( | $view_id = null | ) |
Set the context view ID used when page contains multiple embedded views or displaying the single entry view.
null | $view_id |
used on a has_multiple_views context
Definition at line 243 of file class-frontend-views.php.
References $view_id, and getGvOutputData().
Referenced by parse_content().
set_entry_data | ( | ) |
Set the entry.
Definition at line 433 of file class-frontend-views.php.
References setEntry(), and setSingleEntry().
setEntry | ( | $entry | ) |
Set the current entry.
array | int | $entry | Entry array or entry slug or ID |
Definition at line 187 of file class-frontend-views.php.
References $entry, and GVCommon\get_entry().
Referenced by set_entry_data().
setGvOutputData | ( | $gv_output_data | ) |
\GravityView_View_Data | $gv_output_data |
Definition at line 139 of file class-frontend-views.php.
References $gv_output_data.
Referenced by parse_content().
setIsGravityviewPostType | ( | $is_gravityview_post_type | ) |
boolean | $is_gravityview_post_type |
Definition at line 234 of file class-frontend-views.php.
References $is_gravityview_post_type.
Referenced by parse_content().
setIsSearch | ( | $is_search | ) |
boolean | $is_search |
Definition at line 153 of file class-frontend-views.php.
References $is_search.
Referenced by parse_content().
setPostHasShortcode | ( | $post_has_shortcode | ) |
boolean | $post_has_shortcode |
Definition at line 220 of file class-frontend-views.php.
References $post_has_shortcode.
Referenced by parse_content().
setPostId | ( | $post_id | ) |
int | $post_id |
Definition at line 206 of file class-frontend-views.php.
References $post_id.
Referenced by parse_content().
setSingleEntry | ( | $single_entry | ) |
Sets the single entry ID and also the entry.
bool | int | string | $single_entry |
Definition at line 169 of file class-frontend-views.php.
References $single_entry.
Referenced by set_entry_data().
single_entry_title | ( | $passed_title, | |
$passed_post_id = null |
|||
) |
Filter the title for the single entry view.
string | $passed_title | Current title |
int | $passed_post_id | Post ID |
gravityview/single/title/out_loop
Apply the Single Entry Title filter outside the WordPress loop? boolean | $in_the_loop | Whether to apply the filter to the menu title and the meta tag <title> - outside the loop |
array | $entry | Current entry |
Definition at line 496 of file class-frontend-views.php.
References $entry, $post, Utils\_GET(), _get_single_entry_title(), View\by_id(), View_Collection\from_post(), and gravityview().
$context_view_id = null |
Definition at line 67 of file class-frontend-views.php.
Referenced by get_context_view_id().
$entry = false |
Definition at line 60 of file class-frontend-views.php.
Referenced by getEntry(), setEntry(), and single_entry_title().
$gv_output_data = null |
Definition at line 83 of file class-frontend-views.php.
Referenced by getGvOutputData(), and setGvOutputData().
|
static |
Definition at line 88 of file class-frontend-views.php.
Referenced by Legacy_Context\reset().
$is_gravityview_post_type = false |
Definition at line 31 of file class-frontend-views.php.
Referenced by isGravityviewPostType(), and setIsGravityviewPostType().
$is_search = false |
Definition at line 75 of file class-frontend-views.php.
Referenced by isSearch(), and setIsSearch().
$post_has_shortcode = false |
Definition at line 38 of file class-frontend-views.php.
Referenced by isPostHasShortcode(), and setPostHasShortcode().
$post_id = null |
Definition at line 45 of file class-frontend-views.php.
Referenced by getPostId(), and setPostId().
|
staticprivate |
Definition at line 24 of file class-frontend-views.php.
$single_entry = false |
Definition at line 53 of file class-frontend-views.php.
Referenced by getSingleEntry(), is_single_entry(), and setSingleEntry().