GravityView
2.17
The best, easiest way to display Gravity Forms entries on your website.
|
If this file is called directly, abort. More...
Public Member Functions | |
__construct () | |
The constructor. More... | |
__get ( $key) | |
as_data () | |
Be compatible with the old data object. More... | |
can_render ( $context=null, $request=null) | |
Checks whether this view can be accessed or not. More... | |
get_anchor_id () | |
Returns the anchor ID to be used in the View container HTML id attribute. More... | |
get_entries ( $request=null) | |
Retrieve the entries for the current view and request. More... | |
get_post () | |
Return associated WP post. More... | |
get_query_class () | |
Return the query class for this View. More... | |
offsetExists ( $offset) | |
ArrayAccess compatibility layer with GravityView_View_Data::$views. More... | |
offsetGet ( $offset) | |
ArrayAccess compatibility layer with GravityView_View_Data::$views. More... | |
offsetSet ( $offset, $value) | |
ArrayAccess compatibility layer with GravityView_View_Data::$views. More... | |
offsetUnset ( $offset) | |
ArrayAccess compatibility layer with GravityView_View_Data::$views. More... | |
set_anchor_id ( $counter=1) | |
Sets the anchor ID of a View, without the prefix. More... | |
Static Public Member Functions | |
static | _flush_cache ( $view_id=null) |
Flush the view cache. More... | |
static | add_rewrite_endpoint () |
Add extra rewrite endpoints. More... | |
static | by_id ( $post_id) |
Construct a instance from a post ID. More... | |
static | content ( $content) |
A renderer filter for the View post type content. More... | |
static | exists ( $view) |
Determines if a view exists to begin with. More... | |
static | from_post ( $post) |
Construct a instance from a . More... | |
static | get_joined_forms ( $post_id) |
Get joined forms associated with a view In no particular order. More... | |
static | get_joins ( $post) |
Get joins associated with a view. More... | |
static | get_unions ( $post) |
Get unions associated with a view. More... | |
static | register_post_type () |
Register the gravityview WordPress Custom Post Type. More... | |
static | restrict ( $caps, $cap, $user_id, $args) |
Restrict View access to specific capabilities. More... | |
static | template_redirect () |
Last chance to configure the output. More... | |
Data Fields | |
$fields | |
$form | |
$joins = array() | |
$settings | |
$unions = array() | |
$widgets | |
Private Attributes | |
$anchor_id | |
$post | |
Static Private Attributes | |
static | $cache = array() |
If this file is called directly, abort.
The default GravityView View class.
Houses all base View functionality.
Can be accessed as an array for old compatibility's sake in line with the elements inside the ::$views array.
Definition at line 17 of file class-gv-view.php.
__construct | ( | ) |
The constructor.
Definition at line 107 of file class-gv-view.php.
__get | ( | $key | ) |
Definition at line 1633 of file class-gv-view.php.
|
static |
Flush the view cache.
int | $view_id | The View to reset cache for. Optional. Default: resets everything. |
Definition at line 801 of file class-gv-view.php.
References $view_id.
|
static |
as_data | ( | ) |
Be compatible with the old data object.
Some external code expects an array (doing things like foreach on this, or array_keys) so let's return an array in the old format for such cases. Do not use unless using for back-compatibility.
Definition at line 930 of file class-gv-view.php.
References gravityview_get_form().
|
static |
Construct a instance from a post ID.
int | string | $post_id | The post ID. |
Definition at line 818 of file class-gv-view.php.
References $post.
Referenced by GravityView_Delete_Entry\add_delete_button(), GravityView_Admin_Bar\add_floaty_icon(), GravityView_frontend\add_scripts_and_styles(), GravityView_Entry_Approval\autounapprove(), gvfield\callback(), gravityview\callback(), GravityView_Delete_Entry\check_user_cap_delete_entry(), GravityView_Edit_Entry_Render\edit_entry_form(), GravityView_Widget_Search\filter_entries(), GravityView_Edit_Entry_Render\get_configured_edit_fields(), GravityView_Recent_Entries_Widget\get_entries(), GravityView_Entry_Link_Shortcode\get_entry(), GVCommon\get_entry(), GravityView_View_Data\get_fields(), Views_Route\get_item_permissions_check(), Views_Route\get_sub_item(), Views_Route\get_sub_item_permissions_check(), GravityView_View_Data\get_view(), GV\Mocks\GravityView_frontend_get_view_entries(), GV\Mocks\GravityView_View_Data_add_view(), GravityView_Edit_Entry_Render\maybe_print_message(), oEmbed\parse_matches(), Views_Route\prepare_entry_for_response(), GravityView_Delete_Entry\process_delete(), GravityView_Widget_Search\render_frontend(), GravityView_View\render_widget_hooks(), GravityView_Field_Sequence\replace_merge_tag(), and GravityView_frontend\single_entry_title().
can_render | ( | $context = null , |
|
$request = null |
|||
) |
Checks whether this view can be accessed or not.
string[] | $context The context we're asking for access from. Can any and as many of one of: edit An edit context. single A single context. cpt The custom post type single page accessed. shortcode Embedded as a shortcode. oembed Embedded as an oEmbed. rest A REST call. | |
\GV\Request | $request | The request |
gravityview/view/can_render
Whether the view can be rendered or not. bool | \WP_Error | $result | The result. Default: null. |
\GV\View | $view | The view. |
string[] | $context See ::can_render | |
\GV\Request | $request | The request. |
This View is password protected. Nothing to do here.
Is this View directly accessible via a post URL?
gravityview_direct_access
Should Views be directly accessible, or only visible using the shortcode? boolean | true : allow Views to be accessible directly. false : Only allow Views to be embedded. Default: true | |
int | $view_id | The ID of the View currently being requested. 0 for general setting |
gravityview/request/output/direct
Should this View be directly accessbile? boolean | Accessible or not. Default: accessbile. | |
\GV\View | $view | The View we're trying to directly render here. |
\GV\Request | $request | The current request. |
Is this View an embed-only View? If so, don't allow rendering here, as this is a direct request.
Private, pending, draft, etc.
Definition at line 429 of file class-gv-view.php.
References gravityview(), and GVCommon\has_cap().
|
static |
A renderer filter for the View post type content.
string | $content | Should be empty, as we don't store anything there. |
This is not a View. Bail.
Shortcodes and oEmbeds and whatnot will be handled elsewhere.
Check permissions.
This View has no data source. There's nothing to show really. ...apart from a nice message if the user can do anything about it.
Editing a single entry.
Viewing a single entry.
Plain old View.
Definition at line 264 of file class-gv-view.php.
References $content, $entry, $image, $title, GVCommon\check_entry_display(), gravityview(), GRAVITYVIEW_FILE, GVCommon\has_cap(), GravityView_Entry_Approval_Status\is_approved(), and GravityView_Entry_Approval\meta_key.
|
static |
Determines if a view exists to begin with.
int | \WP_Post | null | $view | The WordPress post ID, a object or null for global $post; |
Definition at line 834 of file class-gv-view.php.
Referenced by GravityView_View_Data\maybe_get_view_id().
|
static |
Construct a instance from a .
\WP_Post | $post | The instance to wrap. |
gravityview/view/get
Override View. \GV\View | $view | The View instance pointer. |
Get connected form.
gravityview/configuration/fields
Filter the View fields' configuration array. $fields | array Multi-array of fields with first level being the field zones. |
$view_id | int The View the fields are being pulled for. |
gravityview/view/configuration/fields
Filter the View fields' configuration array. array | $fields | Multi-array of fields with first level being the field zones. |
\GV\View | $view | The View the fields are being pulled for. |
gravityview/view/fields
Filter the Field Collection for this View. \GV\Field_Collection | $fields | A collection of fields. |
\GV\View | $view | The View the fields are being pulled for. |
gravityview/view/configuration/widgets
Filter the View widgets' configuration array. array | $fields | Multi-array of widgets with first level being the field zones. |
\GV\View | $view | The View the widgets are being pulled for. |
gravityview/view/widgets
Filter the Widget Collection for this View. \GV\Widget_Collection | $widgets | A collection of widgets. |
\GV\View | $view | The View the widgets are being pulled for. |
View configuration.
Add the template name into the settings.
View basics.
gravityview/view/get
Override View. \GV\View | $view | The View instance pointer. |
Definition at line 689 of file class-gv-view.php.
References $post, gravityview(), gravityview_get_template_id(), and gravityview_get_template_settings().
Referenced by Request\is_view(), oEmbed\parse_matches(), Views_Route\prepare_view_for_response(), GravityView_Admin_Views\render_active_areas(), and GravityView_Admin_Metaboxes\render_view_configuration_metabox().
get_anchor_id | ( | ) |
Returns the anchor ID to be used in the View container HTML id
attribute.
gravityview/view/anchor_id
Modify the anchor ID. string | $anchor_id | The anchor ID. |
\GV\View | $this | The View. |
Definition at line 1623 of file class-gv-view.php.
get_entries | ( | $request = null | ) |
Retrieve the entries for the current view and request.
Remove multiple sorting before calling legacy filters. This allows us to fake it till we make it.
Cleanup duplicate field_filter parameters to simplify the query.
$query
Apply multisort.
Merge time subfield sorts.
ORDER again.
Any joins?
This is a temporary stub filter, until GF_Query supports NULL conditions. Do not use! This filter will be removed.
Unions?
\GF_Query_Condition | $condition | |
array | $fields | |
$recurse |
| $q
gravityview/view/query
Override the before the get() call. \GF_Query | $query | The current query object reference |
\GV\View | $this | The current view object |
\GV\Request | $request | The request object |
Map from Gravity Forms entries arrays to an Entry_Collection.
Add total count callback.
gravityview/view/entries
Modify the entry fetching filters, sorts, offsets, limits. \GV\Entry_Collection | $entries | The entries for this view. |
\GV\View | $view | The view. |
\GV\Request | $request | The request. |
Definition at line 950 of file class-gv-view.php.
References $entries, $entry, $field, $form_id, GravityView_frontend\_override_sorting_id_by_field_type(), GravityView_Entry_Approval_Status\APPROVED, Entry_Sort\ASC, GVCommon\calculate_get_entries_criteria(), Entry_Sort\DESC, Utils\get(), gravityview(), GVCommon\has_cap(), GVCommon\is_field_numeric(), and GravityView_Entry_Approval\meta_key.
|
static |
Get joined forms associated with a view In no particular order.
int | $post_id | ID of the View |
Definition at line 582 of file class-gv-view.php.
References GV\$form, $forms, and gravityview().
Referenced by GravityView_Admin_Views\render_field_pickers().
|
static |
Get joins associated with a view.
\WP_Post | $post | GravityView CPT to get joins for |
Definition at line 532 of file class-gv-view.php.
References $post, and gravityview().
get_post | ( | ) |
Return associated WP post.
Definition at line 1648 of file class-gv-view.php.
get_query_class | ( | ) |
Return the query class for this View.
gravityview/query/class
string | The query class. Default: GF_Query. | |
\GV\View | $this | The View. |
Definition at line 1543 of file class-gv-view.php.
|
static |
Get unions associated with a view.
\WP_Post | $post | GravityView CPT to get unions for |
Definition at line 634 of file class-gv-view.php.
References $field, $field_id, $form_id, $post, Internal_Field\by_id(), GF_Field\by_id(), and gravityview().
offsetExists | ( | $offset | ) |
ArrayAccess compatibility layer with GravityView_View_Data::$views.
Definition at line 847 of file class-gv-view.php.
offsetGet | ( | $offset | ) |
ArrayAccess compatibility layer with GravityView_View_Data::$views.
Maps the old keys to the new data;
Definition at line 864 of file class-gv-view.php.
References GV\$form, and gravityview().
offsetSet | ( | $offset, | |
$value | |||
) |
ArrayAccess compatibility layer with GravityView_View_Data::$views.
Definition at line 901 of file class-gv-view.php.
References gravityview().
offsetUnset | ( | $offset | ) |
ArrayAccess compatibility layer with GravityView_View_Data::$views.
Definition at line 914 of file class-gv-view.php.
References gravityview().
|
static |
Register the gravityview WordPress Custom Post Type.
Register only once
gravityview_is_hierarchical
Make GravityView Views hierarchical by returning TRUE This will allow for Views to be nested with Parents and also allows for menu order to be set in the Page Attributes metabox boolean | $is_hierarchical | Default: false |
gravityview_post_type_supports
Modify post type support values for gravityview
post type array | $supports | Array of features associated with a functional area of the edit screen. Default: 'title', 'revisions'. If $is_hierarchical, also 'page-attributes' |
boolean | $is_hierarchical | Do Views support parent/child relationships? See gravityview_is_hierarchical filter. |
Register Custom Post Type - gravityview
gravityview_direct_access
Should Views be directly accessible, or only visible using the shortcode? boolean | true : allow Views to be accessible directly. false : Only allow Views to be embedded via shortcode. Default: true | |
int | $view_id | The ID of the View currently being requested. 0 for general setting |
gravityview_has_archive
Enable Custom Post Type archive? boolean | False: don't have frontend archive; True: yes, have archive. Default: false |
gravityview_slug
Modify the url part for a View. string | $slug | The slug shown in the URL |
gravityview/post_type/with_front
Should the permalink structure be prepended with the front base. (example: if your permalink structure is /blog/, then your links will be: false->/view/, true->/blog/view/). Defaults to true. bool | $with_front |
Definition at line 119 of file class-gv-view.php.
References $args, $labels, gravityview(), and GravityView_Admin\no_views_text().
Referenced by GravityView_Post_Types\init_post_types().
|
static |
Restrict View access to specific capabilities.
Hooked into map_meta_cap
WordPress filter.
$caps | array The output capabilities. |
$cap | string The cap that is being checked. |
$user_id | int The User ID. |
$args | array Additional arguments to the capability. |
gravityview/security/require_unfiltered_html
Bypass restrictions on Views that require unfiltered_html
. boolean |
string | $cap | The capability requested. |
int | $user_id | The user ID. |
array | $args | Any additional args to map_meta_cap |
Definition at line 1567 of file class-gv-view.php.
set_anchor_id | ( | $counter = 1 | ) |
Sets the anchor ID of a View, without the prefix.
int | $counter | An incremental counter reflecting how many times this View has been rendered. |
Definition at line 1612 of file class-gv-view.php.
|
static |
Last chance to configure the output.
Used for CSV output, for example.
CSV output.
gravityview/output/{csv|tsv}/filename
Modify the name of the generated CSV or TSV file. Name will be sanitized using sanitize_file_name() before output. string | $filename | File name used when downloading a CSV or TSV. Default is "{View title}.csv" or "{View title}.tsv" |
\GV\View | $view | Current View being rendered |
Add da' BOM if GF uses it
gravityview/csv/entry/fields
Allowlist more entry fields by ID that are output in CSV requests. array | $allowed | The allowed ones, default by_visible, by_position( "context_*" ), i.e. as set in the View. |
\GV\View | $view | The view. |
\GV\Entry | $entry | WordPress representation of the item. |
Definition at line 1420 of file class-gv-view.php.
References $entries, $entry, $field, $field_id, $label, Internal_Field\by_id(), GF_Field\by_id(), and gravityview().
|
private |
Definition at line 67 of file class-gv-view.php.
|
staticprivate |
Definition at line 77 of file class-gv-view.php.
$fields |
Definition at line 58 of file class-gv-view.php.
$form |
Definition at line 48 of file class-gv-view.php.
$joins = array() |
Definition at line 85 of file class-gv-view.php.
|
private |
Definition at line 22 of file class-gv-view.php.
$settings |
Definition at line 30 of file class-gv-view.php.
$unions = array() |
Definition at line 102 of file class-gv-view.php.
$widgets |
Definition at line 38 of file class-gv-view.php.