@@ 24-44 (lines=21) @@ | ||
21 | * |
|
22 | * @since 2.2.0 |
|
23 | */ |
|
24 | public function register_routes() { |
|
25 | // Returns all boxes data. |
|
26 | register_rest_route( CMB2_REST::BASE, '/boxes/', array( |
|
27 | array( |
|
28 | 'methods' => WP_REST_Server::READABLE, |
|
29 | 'callback' => array( $this, 'get_boxes' ), |
|
30 | 'permission_callback' => array( $this, 'get_item_permissions_check' ), |
|
31 | ), |
|
32 | 'schema' => array( $this, 'get_item_schema' ), |
|
33 | ) ); |
|
34 | ||
35 | // Returns specific box's data. |
|
36 | register_rest_route( CMB2_REST::BASE, '/boxes/(?P<cmb_id>[\w-]+)', array( |
|
37 | array( |
|
38 | 'methods' => WP_REST_Server::READABLE, |
|
39 | 'callback' => array( $this, 'get_box' ), |
|
40 | 'permission_callback' => array( $this, 'get_item_permissions_check' ), |
|
41 | ), |
|
42 | 'schema' => array( $this, 'get_item_schema' ), |
|
43 | ) ); |
|
44 | } |
|
45 | ||
46 | /** |
|
47 | * Get all public fields |
@@ 24-44 (lines=21) @@ | ||
21 | * |
|
22 | * @since 2.2.0 |
|
23 | */ |
|
24 | public function register_routes() { |
|
25 | // Returns specific box's fields. |
|
26 | register_rest_route( CMB2_REST::BASE, '/boxes/(?P<cmb_id>[\w-]+)/fields/', array( |
|
27 | array( |
|
28 | 'methods' => WP_REST_Server::READABLE, |
|
29 | 'callback' => array( $this, 'get_fields' ), |
|
30 | 'permission_callback' => array( $this, 'get_item_permissions_check' ), |
|
31 | ), |
|
32 | 'schema' => array( $this, 'get_item_schema' ), |
|
33 | ) ); |
|
34 | ||
35 | // Returns specific field data. |
|
36 | register_rest_route( CMB2_REST::BASE, '/boxes/(?P<cmb_id>[\w-]+)/fields/(?P<field_id>[\w-]+)', array( |
|
37 | array( |
|
38 | 'methods' => WP_REST_Server::READABLE, |
|
39 | 'callback' => array( $this, 'get_field' ), |
|
40 | 'permission_callback' => array( $this, 'get_item_permissions_check' ), |
|
41 | ), |
|
42 | 'schema' => array( $this, 'get_item_schema' ), |
|
43 | ) ); |
|
44 | } |
|
45 | ||
46 | /** |
|
47 | * Get all box fields |