WP_REST_Widget_Types_Controller::prepare_links()protectedWP 5.8.0

Prepares links for the widget type.

Method of the class: WP_REST_Widget_Types_Controller{}

No Hooks.

Return

Array. Links for the given widget type.

Usage

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

Changelog

Since 5.8.0 Introduced.

WP_REST_Widget_Types_Controller::prepare_links() code WP 6.4.3

protected function prepare_links( $widget_type ) {
	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, $widget_type['id'] ) ),
		),
	);
}