Automattic\WooCommerce\Internal\Orders
OrderActionsRestController::register_routes
Register the REST API endpoints handled by this controller.
Метод класса: OrderActionsRestController{}
Хуков нет.
Возвращает
null. Ничего (null).
Использование
$OrderActionsRestController = new OrderActionsRestController(); $OrderActionsRestController->register_routes(): void;
Код OrderActionsRestController::register_routes() OrderActionsRestController::register routes WC 10.3.5
public function register_routes(): void {
register_rest_route(
$this->route_namespace,
'/orders/(?P<id>[\d]+)/actions/email_templates',
array(
'args' => array(
'id' => array(
'description' => __( 'Unique identifier of the order.', 'woocommerce' ),
'type' => 'integer',
),
),
array(
'methods' => WP_REST_Server::READABLE,
'callback' => fn( $request ) => $this->run( $request, 'get_email_templates' ),
'permission_callback' => fn( $request ) => $this->check_permissions( $request ),
'args' => array(),
),
'schema' => array( $this, 'get_schema_for_email_templates' ),
)
);
register_rest_route(
$this->route_namespace,
'/orders/(?P<id>[\d]+)/actions/send_email',
array(
'args' => array(
'id' => array(
'description' => __( 'Unique identifier of the order.', 'woocommerce' ),
'type' => 'integer',
),
),
array(
'methods' => WP_REST_Server::CREATABLE,
'callback' => fn( $request ) => $this->run( $request, 'send_email' ),
'permission_callback' => fn( $request ) => $this->check_permissions( $request ),
'args' => $this->get_args_for_order_actions( 'send_email', WP_REST_Server::CREATABLE ),
),
'schema' => array( $this, 'get_schema_for_order_actions' ),
)
);
register_rest_route(
$this->route_namespace,
'/orders/(?P<id>[\d]+)/actions/send_order_details',
array(
'args' => array(
'id' => array(
'description' => __( 'Unique identifier of the order.', 'woocommerce' ),
'type' => 'integer',
),
),
array(
'methods' => WP_REST_Server::CREATABLE,
'callback' => fn( $request ) => $this->run( $request, 'send_order_details' ),
'permission_callback' => fn( $request ) => $this->check_permissions( $request ),
'args' => $this->get_args_for_order_actions( 'send_order_details', WP_REST_Server::CREATABLE ),
),
'schema' => array( $this, 'get_schema_for_order_actions' ),
)
);
}