WC_REST_Customer_Downloads_V1_Controller::prepare_links
Prepare links for the request.
Метод класса: WC_REST_Customer_Downloads_V1_Controller{}
Хуков нет.
Возвращает
Массив. Links for the given customer download.
Использование
// protected - в коде основоного (родительского) или дочернего класса $result = $this->prepare_links( $download, $request );
- $download(stdClass) (обязательный)
- Download object.
- $request(WP_REST_Request) (обязательный)
- Request object.
Код WC_REST_Customer_Downloads_V1_Controller::prepare_links() WC REST Customer Downloads V1 Controller::prepare links WC 10.9.4
protected function prepare_links( $download, $request ) {
$base = str_replace( '(?P<customer_id>[\d]+)', $request['customer_id'], $this->rest_base );
$links = array(
'collection' => array(
'href' => rest_url( sprintf( '/%s/%s', $this->namespace, $base ) ),
),
'product' => array(
'href' => rest_url( sprintf( '/%s/products/%d', $this->namespace, $download->product_id ) ),
),
'order' => array(
'href' => rest_url( sprintf( '/%s/orders/%d', $this->namespace, $download->order_id ) ),
),
);
return $links;
}