CMB2 Documentation
  • Package
  • Class
  • Tree
  • Deprecated
  • Todo
  • Hooks
  • Download Docs
  • Github

Packages

  • CMB2
  • Demo
    • CMB2
  • None
  • Tests
    • CMB2

Classes

  • CMB2
  • CMB2_Ajax
  • CMB2_Base
  • CMB2_Bootstrap_2101
  • CMB2_Boxes
  • CMB2_Display_Checkbox
  • CMB2_Display_Colorpicker
  • CMB2_Display_File
  • CMB2_Display_File_List
  • CMB2_Display_Multicheck
  • CMB2_Display_oEmbed
  • CMB2_Display_Select
  • CMB2_Display_Taxonomy_Multicheck
  • CMB2_Display_Taxonomy_Radio
  • CMB2_Display_Text_Date
  • CMB2_Display_Text_Date_Timezone
  • CMB2_Display_Text_Money
  • CMB2_Display_Text_Time
  • CMB2_Display_Text_Url
  • CMB2_Display_Textarea
  • CMB2_Display_Textarea_Code
  • CMB2_Field
  • CMB2_Field_Display
  • CMB2_Hookup
  • CMB2_Hookup_Base
  • CMB2_JS
  • CMB2_Option
  • CMB2_Options
  • CMB2_Options_Hookup
  • CMB2_REST
  • CMB2_REST_Controller
  • CMB2_REST_Controller_Boxes
  • CMB2_REST_Controller_Fields
  • CMB2_Sanitize
  • CMB2_Show_Filters
  • CMB2_Type_Base
  • CMB2_Type_Checkbox
  • CMB2_Type_Colorpicker
  • CMB2_Type_Counter_Base
  • CMB2_Type_File
  • CMB2_Type_File_Base
  • CMB2_Type_File_List
  • CMB2_Type_Multi_Base
  • CMB2_Type_Multicheck
  • CMB2_Type_Oembed
  • CMB2_Type_Picker_Base
  • CMB2_Type_Radio
  • CMB2_Type_Select
  • CMB2_Type_Select_Timezone
  • CMB2_Type_Taxonomy_Base
  • CMB2_Type_Taxonomy_Multicheck
  • CMB2_Type_Taxonomy_Multicheck_Hierarchical
  • CMB2_Type_Taxonomy_Radio
  • CMB2_Type_Taxonomy_Radio_Hierarchical
  • CMB2_Type_Taxonomy_Select
  • CMB2_Type_Taxonomy_Select_Hierarchical
  • CMB2_Type_Text
  • CMB2_Type_Text_Date
  • CMB2_Type_Text_Datetime_Timestamp
  • CMB2_Type_Text_Datetime_Timestamp_Timezone
  • CMB2_Type_Text_Time
  • CMB2_Type_Textarea
  • CMB2_Type_Textarea_Code
  • CMB2_Type_Title
  • CMB2_Type_Wysiwyg
  • CMB2_Types
  • CMB2_Utils
  • Test_CMB2_Utils_WIN

Functions

  • _tests_cmb2_manually_load_plugin
  • cmb2_ajax
  • cmb2_autoload_classes
  • cmb2_bootstrap
  • cmb2_dir
  • cmb2_do_oembed
  • cmb2_get_field
  • cmb2_get_field_value
  • cmb2_get_metabox
  • cmb2_get_metabox_form
  • cmb2_get_metabox_sanitized_values
  • cmb2_get_oembed
  • cmb2_get_option
  • cmb2_metabox_form
  • cmb2_options
  • cmb2_print_metabox_form
  • cmb2_update_option
  • cmb2_utils
  • date_create_from_format
  • date_timestamp_get
  • new_cmb2_box

Hooks

  • Hook Reference

Class CMB2_REST_Controller_Boxes

CMB2 objects/boxes endpoint for WordPres REST API. Allows access to boxes configuration data.

WP_REST_Controller
Extended by CMB2_REST_Controller
Extended by CMB2_REST_Controller_Boxes

Direct known subclasses

CMB2_REST_Controller_Fields

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_Boxes.php

Methods summary

public
# __construct( WP_REST_Server $wp_rest_server )

Constructor

Constructor

Since

2.2.3

Overrides

CMB2_REST_Controller::__construct
public
# register_routes( )

Register the routes for the objects of the controller.

Register the routes for the objects of the controller.

Since

2.2.3

Overrides

WP_REST_Controller::register_routes
public WP_Error|boolean
# get_items_permissions_check( WP_REST_Request $request )

Check if a given request has access to get boxes.

Check if a given request has access to get boxes.

Parameters

$request
Full data about the request.

Returns

WP_Error|boolean

Since

2.2.3

Overrides

WP_REST_Controller::get_items_permissions_check
public WP_Error|WP_REST_Response
# get_items( WP_REST_Request $request )

Get all public CMB2 boxes.

Get all public CMB2 boxes.

Parameters

$request
Full data about the request.

Returns

WP_Error|WP_REST_Response

Since

2.2.3

Overrides

WP_REST_Controller::get_items
public WP_Error|boolean
# get_item_permissions_check( WP_REST_Request $request )

Check if a given request has access to a box. By default, no special permissions needed, but filtering return value.

Check if a given request has access to a box. By default, no special permissions needed, but filtering return value.

Parameters

$request
Full details about the request.

Returns

WP_Error|boolean

Since

2.2.3

Overrides

WP_REST_Controller::get_item_permissions_check
public WP_Error|boolean
# get_item_permissions_check_filter( boolean $can_access = true )

Check by filter if a given request has access to a box. By default, no special permissions needed, but filtering return value.

Check by filter if a given request has access to a box. By default, no special permissions needed, but filtering return value.

Parameters

$can_access
Whether the current request has access to view the box by default.

Returns

WP_Error|boolean

Since

2.2.3
public WP_Error|WP_REST_Response
# get_item( WP_REST_Request $request )

Get one CMB2 box from the collection.

Get one CMB2 box from the collection.

Parameters

$request
Full data about the request.

Returns

WP_Error|WP_REST_Response

Since

2.2.3

Overrides

WP_REST_Controller::get_item
public array
# get_rest_box( )

Get a CMB2 box prepared for REST

Get a CMB2 box prepared for REST

Returns

array

Since

2.2.3
protected array
# prepare_links( CMB2_REST $cmb )

Return an array of contextual links for box/boxes.

Return an array of contextual links for box/boxes.

Parameters

$cmb
CMB2_REST object to build links from.

Returns

array
Array of links

Since

2.2.3

Methods inherited from CMB2_REST_Controller

get_cb_results(), get_intial_request_type(), get_intial_route(), get_item_schema(), get_query_string(), initiate_request(), initiate_rest_box(), initiate_rest_edit_box(), initiate_rest_read_box(), maybe_hook_callback_and_apply_filters(), maybe_hook_registered_callback(), maybe_unhook_registered_callback(), prepare_item(), prepare_item_for_response()

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_object_type(), get_post(), get_public_item_schema(), prepare_item_for_database(), prepare_response_for_collection(), update_additional_fields_for_object(), update_item(), update_item_permissions_check()

Properties summary

protected string $rest_base

The base of this controller's route.

The base of this controller's route.

# 'boxes'
protected string $namespace_base

The combined $namespace and $rest_base for these routes.

The combined $namespace and $rest_base for these routes.

# ''

Properties inherited from CMB2_REST_Controller

$field, $namespace, $object_id, $object_type, $request, $request_type, $rest_box, $route, $server

CMB2 Documentation API documentation generated by ApiGen