WC_REST_Setting_Options_V2_Controller::register_routes() public WC 3.0.0
Register routes.
{} It's a method of the class: WC_REST_Setting_Options_V2_Controller{}
No Hooks.
Return
Null. Nothing.
Usage
$WC_REST_Setting_Options_V2_Controller = new WC_REST_Setting_Options_V2_Controller(); $WC_REST_Setting_Options_V2_Controller->register_routes();
Changelog
Since 3.0.0 | Introduced. |
Code of WC_REST_Setting_Options_V2_Controller::register_routes() WC REST Setting Options V2 Controller::register routes WC 5.0.0
public function register_routes() {
register_rest_route(
$this->namespace, '/' . $this->rest_base, array(
'args' => array(
'group' => array(
'description' => __( 'Settings group ID.', 'woocommerce' ),
'type' => 'string',
),
),
array(
'methods' => WP_REST_Server::READABLE,
'callback' => array( $this, 'get_items' ),
'permission_callback' => array( $this, 'get_items_permissions_check' ),
),
'schema' => array( $this, 'get_public_item_schema' ),
)
);
register_rest_route(
$this->namespace, '/' . $this->rest_base . '/batch', array(
'args' => array(
'group' => array(
'description' => __( 'Settings group ID.', 'woocommerce' ),
'type' => 'string',
),
),
array(
'methods' => WP_REST_Server::EDITABLE,
'callback' => array( $this, 'batch_items' ),
'permission_callback' => array( $this, 'update_items_permissions_check' ),
'args' => $this->get_endpoint_args_for_item_schema( WP_REST_Server::EDITABLE ),
),
'schema' => array( $this, 'get_public_batch_schema' ),
)
);
register_rest_route(
$this->namespace, '/' . $this->rest_base . '/(?P<id>[\w-]+)', array(
'args' => array(
'group' => array(
'description' => __( 'Settings group ID.', 'woocommerce' ),
'type' => 'string',
),
'id' => array(
'description' => __( 'Unique identifier for the resource.', 'woocommerce' ),
'type' => 'string',
),
),
array(
'methods' => WP_REST_Server::READABLE,
'callback' => array( $this, 'get_item' ),
'permission_callback' => array( $this, 'get_items_permissions_check' ),
),
array(
'methods' => WP_REST_Server::EDITABLE,
'callback' => array( $this, 'update_item' ),
'permission_callback' => array( $this, 'update_items_permissions_check' ),
'args' => $this->get_endpoint_args_for_item_schema( WP_REST_Server::EDITABLE ),
),
'schema' => array( $this, 'get_public_item_schema' ),
)
);
}