WC_REST_Data_Controller::prepare_links()protectedWC 1.0

Prepare links for the request.

Метод класса: WC_REST_Data_Controller{}

Хуков нет.

Возвращает

Массив. Links for the given country.

Использование

// protected - в коде основоного (родительского) или дочернего класса
$result = $this->prepare_links( $item );
$item(объект) (обязательный)
Data object.

Код WC_REST_Data_Controller::prepare_links() WC 8.7.0

protected function prepare_links( $item ) {
	$links = array(
		'self'       => array(
			'href' => rest_url( sprintf( '/%s/%s/%s', $this->namespace, $this->rest_base, $item->slug ) ),
		),
		'collection' => array(
			'href' => rest_url( sprintf( '%s/%s', $this->namespace, $this->rest_base ) ),
		),
	);

	return $links;
}