WC_REST_Shipping_Zone_Methods_V2_Controller::prepare_links()protectedWC 1.0

Prepare links for the request.

Method of the class: WC_REST_Shipping_Zone_Methods_V2_Controller{}

No Hooks.

Return

Array. Links for the given Shipping Zone Method.

Usage

// protected - for code of main (parent) or child class
$result = $this->prepare_links( $zone_id, $instance_id );
$zone_id(int) (required)
Given Shipping Zone ID.
$instance_id(int) (required)
Given Shipping Zone Method Instance ID.

WC_REST_Shipping_Zone_Methods_V2_Controller::prepare_links() code WC 8.7.0

protected function prepare_links( $zone_id, $instance_id ) {
	$base  = '/' . $this->namespace . '/' . $this->rest_base . '/' . $zone_id;
	$links = array(
		'self'       => array(
			'href' => rest_url( $base . '/methods/' . $instance_id ),
		),
		'collection' => array(
			'href' => rest_url( $base . '/methods' ),
		),
		'describes'  => array(
			'href' => rest_url( $base ),
		),
	);

	return $links;
}