WP_REST_Template_Autosaves_Controller::prepare_links()protectedWP 6.4.0

Prepares links for the request.

Method of the class: WP_REST_Template_Autosaves_Controller{}

No Hooks.

Return

Array. Links for the given post.

Usage

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

Changelog

Since 6.4.0 Introduced.

WP_REST_Template_Autosaves_Controller::prepare_links() code WP 6.6.2

protected function prepare_links( $template ) {
	$links = array(
		'self'   => array(
			'href' => rest_url( sprintf( '/%s/%s/%s/%s/%d', $this->namespace, $this->parent_base, $template->id, $this->rest_base, $template->wp_id ) ),
		),
		'parent' => array(
			'href' => rest_url( sprintf( '/%s/%s/%s', $this->namespace, $this->parent_base, $template->id ) ),
		),
	);

	return $links;
}