WP_REST_Sidebars_Controller::prepare_links()protectedWP 5.8.0

Prepares links for the sidebar.

{} It's a method of the class: WP_REST_Sidebars_Controller{}

No Hooks.

Return

Array. Links for the given widget.

Usage

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

Changelog

Since 5.8.0 Introduced.

Code of WP_REST_Sidebars_Controller::prepare_links() WP 6.0

protected function prepare_links( $sidebar ) {
	return array(
		'collection'               => array(
			'href' => rest_url( sprintf( '%s/%s', $this->namespace, $this->rest_base ) ),
		),
		'self'                     => array(
			'href' => rest_url( sprintf( '%s/%s/%s', $this->namespace, $this->rest_base, $sidebar['id'] ) ),
		),
		'https://api.w.org/widget' => array(
			'href'       => add_query_arg( 'sidebar', $sidebar['id'], rest_url( '/wp/v2/widgets' ) ),
			'embeddable' => true,
		),
	);
}