GravityView  2.1.1
The best, easiest way to display Gravity Forms entries on your website.
Public Member Functions | Protected Attributes
Views_Route Class Reference

If this file is called directly, abort. More...

Inheritance diagram for Views_Route:
Route

Public Member Functions

 get_item ( $request)
 Get one view. More...
 
 get_item_permissions_check ( $request)
 
 get_items ( $request)
 Get a collection of views. More...
 
 get_items_permissions_check ( $request)
 
 get_sub_item ( $request)
 Get one entry from view. More...
 
 get_sub_item_permissions_check ( $request)
 
 get_sub_items_permissions_check ( $request)
 
 prepare_entry_for_response ( $view, $entry, \WP_REST_Request $request, $context, $class=null)
 Prepare the item for the REST response. More...
 
 prepare_view_for_response ( $view_post, \WP_REST_Request $request)
 Prepare the item for the REST response. More...
 
- Public Member Functions inherited from Route
 __call ( $method, $args)
 Fallback if subclass doesn't define routes. More...
 
 create_item ( $request)
 Create one item from the collection. More...
 
 create_item_permissions_check ( $request)
 Check if a given request has access to create items. More...
 
 create_sub_item ( $request)
 Create one item from the collection. More...
 
 delete_item ( $request)
 Delete one item from the collection. More...
 
 delete_item_permissions_check ( $request)
 Check if a given request has access to delete a specific item. More...
 
 delete_sub_item ( $request)
 Delete one item from the collection for sub items. More...
 
 get_item ( $request)
 Get one item from the collection. More...
 
 get_item_permissions_check ( $request)
 Check if a given request has access to get a specific item. More...
 
 get_items ( $request)
 Get a collection of items. More...
 
 get_items_permissions_check ( $request)
 Check if a given request has access to get items. More...
 
 get_sub_item ( $request)
 Get one item from the collection. More...
 
 get_sub_items ( $request)
 Get a collection of items. More...
 
 prepare_item_for_response ( $item, $request)
 Prepare the item for the REST response. More...
 
 register_routes ()
 Register the routes for the objects of the controller. More...
 
 update_item ( $request)
 Update one item from the collection. More...
 
 update_item_permissions_check ( $request)
 Check if a given request has access to update a specific item. More...
 
 update_sub_item ( $request)
 Update one item from the collection for sub items. More...
 

Protected Attributes

 $route_name = 'views'
 Route Name. More...
 
 $sub_type = 'entries'
 
- Protected Attributes inherited from Route
 $route_name
 
 $sub_type
 

Additional Inherited Members

- Protected Member Functions inherited from Route
 get_route_name ()
 Get route name. More...
 
 get_sub_type ()
 Get sub_type. More...
 
 not_implemented ()
 Generic response for routes not yet implemented. More...
 
 prepare_item_for_database ( $request)
 Prepare the item for create or update operation. More...
 

Detailed Description

If this file is called directly, abort.

Definition at line 18 of file class-gv-rest-views-route.php.

Member Function Documentation

◆ get_item()

get_item (   $request)

Get one view.

Callback for /v1/views/{id}/

Since
2.0
Parameters
\WP_REST_Request$requestFull data about the request.
Returns
|

Definition at line 81 of file class-gv-rest-views-route.php.

References $url, $view_id, and Views_Route\prepare_view_for_response().

◆ get_item_permissions_check()

get_item_permissions_check (   $request)
Parameters
\WP_REST_Request$request
Returns
bool|
Runs Filter:
gravityview/view/output/rest Disable rest output. Final chance.
Parameters
[in,out]boolEnable or not.
\GV\View$viewThe view.

Definition at line 354 of file class-gv-rest-views-route.php.

References $url, $view_id, and View\by_id().

Referenced by Views_Route\get_sub_items_permissions_check(), and Views_Route\prepare_view_for_response().

◆ get_items()

get_items (   $request)

Get a collection of views.

Callback for GET /v1/views/

Parameters
\WP_REST_Request$requestFull data about the request.
Returns
|

Definition at line 47 of file class-gv-rest-views-route.php.

References GVCommon\get_all_views(), and Views_Route\prepare_view_for_response().

◆ get_items_permissions_check()

get_items_permissions_check (   $request)

◆ get_sub_item()

get_sub_item (   $request)

Get one entry from view.

Callback for /v1/views/{id}/entries/{id}/

GVCommon::get_entry

Since
2.0
Parameters
\WP_REST_Request$requestFull data about the request.
Returns
|

Definition at line 280 of file class-gv-rest-views-route.php.

References $entry, $format, $url, $view_id, GF_Entry\by_id(), View\by_id(), Utils\get(), and Views_Route\prepare_entry_for_response().

◆ get_sub_item_permissions_check()

get_sub_item_permissions_check (   $request)

◆ get_sub_items_permissions_check()

get_sub_items_permissions_check (   $request)

◆ prepare_entry_for_response()

prepare_entry_for_response (   $view,
  $entry,
\WP_REST_Request  $request,
  $context,
  $class = null 
)

Prepare the item for the REST response.

Since
2.0
Parameters
\GV\View$viewThe view.
\GV\Entry$entryWordPress representation of the item.
\WP_REST_Request$requestRequest object.
string$contextThe context (directory, single)
string$classThe value renderer. Default: null (raw value)
Since
2.1 Add value renderer override $class parameter.
Returns
mixed The data that is sent.
Runs Filter:
gravityview/rest/entry/fields Whitelist more entry fields that are output in regular REST requests.
Parameters
[in,out]array$allowedThe allowed ones, default by_visible, by_position( "context_*" ), i.e. as set in the view.
\GV\View$viewThe view.
\GV\Entry$entryWordPress representation of the item.
\WP_REST_Request$requestRequest object.
string$contextThe context (directory, single)

Definition at line 112 of file class-gv-rest-views-route.php.

References $class, $entries, $entry, $field, $field_id, $format, $output, $post, $url, $view_id, Internal_Field\by_id(), GF_Field\by_id(), View\by_id(), View_Collection\from_post(), Utils\get(), and Route\get_sub_items().

Referenced by Views_Route\get_sub_item().

◆ prepare_view_for_response()

prepare_view_for_response (   $view_post,
\WP_REST_Request  $request 
)

Prepare the item for the REST response.

Since
2.0
Parameters
\WP_Post$view_postWordPress representation of the item.
\WP_REST_Request$requestRequest object.
Returns
mixed

Definition at line 305 of file class-gv-rest-views-route.php.

References View\from_post(), Views_Route\get_item_permissions_check(), and GVCommon\has_cap().

Referenced by Views_Route\get_item(), and Views_Route\get_items().

Field Documentation

◆ $route_name

$route_name = 'views'
protected

Route Name.

Since
2.0

protected

Definition at line 27 of file class-gv-rest-views-route.php.

◆ $sub_type

$sub_type = 'entries'
protected

Definition at line 36 of file class-gv-rest-views-route.php.


The documentation for this class was generated from the following file: