WP_REST_Widget_Types_Controller::prepare_links( array $widget_type )

Prepares links for the widget type.

Parameters

$widget_type

(array) (Required) Widget type data.

Return

(array) Links for the given widget type.

Source

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

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

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_widget_types_controller/prepare_links