WC_REST_Layout_Templates_Controller::register_routes
Register the routes for template layouts.
Method of the class: WC_REST_Layout_Templates_Controller{}
No Hooks.
Returns
null. Nothing (null).
Usage
$WC_REST_Layout_Templates_Controller = new WC_REST_Layout_Templates_Controller(); $WC_REST_Layout_Templates_Controller->register_routes();
WC_REST_Layout_Templates_Controller::register_routes() WC REST Layout Templates Controller::register routes code WC 10.4.3
public function register_routes() {
register_rest_route(
$this->namespace,
'/' . $this->rest_base,
array(
'methods' => WP_REST_Server::READABLE,
'callback' => array( $this, 'get_items' ),
'permission_callback' => array( $this, 'get_items_permissions_check' ),
'args' => array(
'area' => array(
'description' => __( 'Area to get templates for.', 'woocommerce' ),
'type' => 'string',
'default' => '',
),
),
)
);
register_rest_route(
$this->namespace,
'/' . $this->rest_base . '/(?P<id>\w[\w\s\-]*)',
array(
'args' => array(
'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_item_permissions_check' ),
'args' => array(),
),
)
);
}