WP_REST_Sidebars_Controller::prepare_links( array $sidebar )

Prepares links for the sidebar.

Parameters

$sidebar

(array) (Required) Sidebar.

Return

(array) Links for the given widget.

Source

File: wp-includes/rest-api/endpoints/class-wp-rest-sidebars-controller.php

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,
			),
		);
	}

Changelog

Version Description
5.8.0 Introduced.

© 2003–2021 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wp_rest_sidebars_controller/prepare_links