Class CMB2_REST_Controller
Creates CMB2 objects/fields endpoint for WordPres REST API. Allows access to fields registered to a specific post type and more.
- WP_REST_Controller
- CMB2_REST_Controller
Direct known subclasses
Indirect known subclasses
Package: CMB2
Category: WordPress_Plugin
License: GPL-2.0+
Author: CMB2 team
Since: 2.2.3
Link: https://cmb2.io
Todo: Add better documentation.
Todo: Research proper schema.
Located at includes/rest-api/CMB2_REST_Controller.php
Methods summary
public
|
|
public
|
#
maybe_hook_callback_and_apply_filters( string $filter, boolean $default_access )
A wrapper for |
public
boolean
|
#
maybe_hook_registered_callback( string $filter, boolean $default_val )
Checks if the CMB2 box has any registered callback parameters for the given filter. |
public
|
#
maybe_unhook_registered_callback( string $filter )
Unhooks any CMB2 box registered callback parameters for the given filter. |
public
array
|
|
public
mixed
|
|
public
WP_REST_Response
|
#
prepare_item_for_response( mixed $data, WP_REST_Request $request = null )
Prepare the CMB2 item for the REST response. |
protected
|
#
initiate_rest_read_box( WP_REST_Request $request, string $request_type )
Initiates the request property and the rest_box property if box is readable. |
protected
|
#
initiate_rest_edit_box( WP_REST_Request $request, string $request_type )
Initiates the request property and the rest_box property if box is writeable. |
protected
|
#
initiate_rest_box( WP_REST_Request $request, string $request_type )
Initiates the request property and the rest_box property. |
public
|
#
initiate_request( WP_REST_Request $request, string $request_type )
Initiates the request property and sets up the initial static properties. |
public static
string
|
|
public static
string
|
|
public
array
|
|
abstract protected
array
|
|
public
string
|
Methods inherited from WP_REST_Controller
add_additional_fields_schema()
,
add_additional_fields_to_object()
,
create_item()
,
create_item_permissions_check()
,
delete_item()
,
delete_item_permissions_check()
,
filter_response_by_context()
,
get_additional_fields()
,
get_collection_params()
,
get_context_param()
,
get_endpoint_args_for_item_schema()
,
get_item()
,
get_item_permissions_check()
,
get_items()
,
get_items_permissions_check()
,
get_object_type()
,
get_post()
,
get_public_item_schema()
,
prepare_item_for_database()
,
prepare_response_for_collection()
,
register_routes()
,
update_additional_fields_for_object()
,
update_item()
,
update_item_permissions_check()
Properties summary
protected
string
|
$namespace
The namespace of this controller's route. |
#
CMB2_REST::NAME_SPACE
|
protected
string
|
$rest_base
The base of this controller's route. |
|
public
WP_REST_Request
|
$request
The current request object |
|
public
WP_REST_Server
|
$server
The current server object |
|
public
mixed
|
$object_id
Box object id |
#
null
|
public
string
|
$object_type
Box object type |
#
''
|
protected
|
$rest_box
CMB2 Instance |
|
protected
|
$field
CMB2_Field Instance |
|
protected static
string
|
$route
The initial route |
#
''
|
protected static
string
|
$request_type
Defines which endpoint the initial request is. |
#
''
|