WC_REST_Shipping_Methods_V2_Controller::prepare_links()
Prepare links for the request.
Метод класса: WC_REST_Shipping_Methods_V2_Controller{}
Хуков нет.
Возвращает
Массив
.
Использование
// protected - в коде основоного (родительского) или дочернего класса $result = $this->prepare_links( $method, $request );
- $method(WC_Shipping_Method) (обязательный)
- Shipping method object.
- $request(WP_REST_Request) (обязательный)
- Request object.
Код WC_REST_Shipping_Methods_V2_Controller::prepare_links() WC REST Shipping Methods V2 Controller::prepare links WC 8.7.0
protected function prepare_links( $method, $request ) { $links = array( 'self' => array( 'href' => rest_url( sprintf( '/%s/%s/%s', $this->namespace, $this->rest_base, $method->id ) ), ), 'collection' => array( 'href' => rest_url( sprintf( '/%s/%s', $this->namespace, $this->rest_base ) ), ), ); return $links; }