Automattic\WooCommerce\Admin\API\Reports\PerformanceIndicators

Controller::prepare_linksprotectedWC 1.0

Prepare links for the request.

Method of the class: Controller{}

No Hooks.

Returns

Array.

Usage

// protected - for code of main (parent) or child class
$result = $this->prepare_links( $object );
$object(object) (required)
data.

Controller::prepare_links() code WC 9.9.4

protected function prepare_links( $object ) {
	$pieces   = $this->get_stats_parts( $object->stat );
	$endpoint = $pieces[0];
	$stat     = $pieces[1];
	$url      = isset( $this->urls[ $endpoint ] ) ? $this->urls[ $endpoint ] : '';

	$links = array(
		'api'    => array(
			'href' => rest_url( $this->endpoints[ $endpoint ] ),
		),
		'report' => array(
			'href' => $url,
		),
	);

	return $links;
}