WP_REST_Widgets_Controller::prepare_links() – Prepares links for the widget.

You appear to be a bot. Output may be restricted

Description

Prepares links for the widget.

Usage

$array = WP_REST_Widgets_Controller::prepare_links( $prepared );

Parameters

$prepared
( array ) required – Widget.

Returns

array Links for the given widget.

Source

File name: wordpress/wp-includes/rest-api/endpoints/class-wp-rest-widgets-controller.php
Lines:

1 to 19 of 19
  protected function prepare_links( $prepared ) {
    $id_base = ! empty( $prepared['id_base'] ) ? $prepared['id_base'] : $prepared['id'];

    return array(
      'self'                      => array(
        'href' => rest_url( sprintf( '%s/%s/%s', $this->namespace, $this->rest_base, $prepared['id'] ) ),
      ),
      'collection'                => array(
        'href' => rest_url( sprintf( '%s/%s', $this->namespace, $this->rest_base ) ),
      ),
      'about'                     => array(
        'href'       => rest_url( sprintf( 'wp/v2/widget-types/%s', $id_base ) ),
        'embeddable' => true,
      ),
      'https://api.w.org/sidebar' => array(
        'href' => rest_url( sprintf( 'wp/v2/sidebars/%s/', $prepared['sidebar'] ) ),
      ),
    );
  }
 

 View on GitHub View on Trac