[ Index ]

PHP Cross Reference of WordPress

title

Body

[close]

/wp-includes/rest-api/endpoints/ -> class-wp-rest-widget-types-controller.php (summary)

REST API: WP_REST_Widget_Types_Controller class

File Size: 574 lines (16 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

WP_REST_Widget_Types_Controller:: (16 methods):
  __construct()
  register_routes()
  get_items_permissions_check()
  get_items()
  get_item_permissions_check()
  check_read_permission()
  get_widget()
  get_widgets()
  get_item()
  prepare_item_for_response()
  prepare_links()
  get_item_schema()
  encode_form_data()
  get_widget_preview()
  get_widget_form()
  get_collection_params()


Class: WP_REST_Widget_Types_Controller  - X-Ref

Core class to access widget types via the REST API.

__construct()   X-Ref
Constructor.

since: 5.8.0

register_routes()   X-Ref
Registers the widget type routes.

since: 5.8.0

get_items_permissions_check( $request )   X-Ref
Checks whether a given request has permission to read widget types.

since: 5.8.0
param: WP_REST_Request $request Full details about the request.
return: true|WP_Error True if the request has read access, WP_Error object otherwise.

get_items( $request )   X-Ref
Retrieves the list of all widget types.

since: 5.8.0
param: WP_REST_Request $request Full details about the request.
return: WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure.

get_item_permissions_check( $request )   X-Ref
Checks if a given request has access to read a widget type.

since: 5.8.0
param: WP_REST_Request $request Full details about the request.
return: true|WP_Error True if the request has read access for the item, WP_Error object otherwise.

check_read_permission()   X-Ref
Checks whether the user can read widget types.

since: 5.8.0
return: true|WP_Error True if the widget type is visible, WP_Error otherwise.

get_widget( $id )   X-Ref
Gets the details about the requested widget.

since: 5.8.0
param: string $id The widget type id.
return: array|WP_Error The array of widget data if the name is valid, WP_Error otherwise.

get_widgets()   X-Ref
Normalize array of widgets.

since: 5.8.0
return: array Array of widgets.

get_item( $request )   X-Ref
Retrieves a single widget type from the collection.

since: 5.8.0
param: WP_REST_Request $request Full details about the request.
return: WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure.

prepare_item_for_response( $item, $request )   X-Ref
Prepares a widget type object for serialization.

since: 5.8.0
since: 5.9.0 Renamed `$widget_type` to `$item` to match parent class for PHP 8 named parameter support.
param: array           $item    Widget type data.
param: WP_REST_Request $request Full details about the request.
return: WP_REST_Response Widget type data.

prepare_links( $widget_type )   X-Ref
Prepares links for the widget type.

since: 5.8.0
param: array $widget_type Widget type data.
return: array Links for the given widget type.

get_item_schema()   X-Ref
Retrieves the widget type's schema, conforming to JSON Schema.

since: 5.8.0
return: array Item schema data.

encode_form_data( $request )   X-Ref
An RPC-style endpoint which can be used by clients to turn user input in
a widget admin form into an encoded instance object.

Accepts:

- id:        A widget type ID.
- instance:  A widget's encoded instance object. Optional.
- form_data: Form data from submitting a widget's admin form. Optional.

Returns:
- instance: The encoded instance object after updating the widget with
the given form data.
- form:     The widget's admin form after updating the widget with the
given form data.

since: 5.8.0
param: WP_REST_Request $request Full details about the request.
return: WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure.

get_widget_preview( $widget, $instance )   X-Ref
Returns the output of WP_Widget::widget() when called with the provided
instance. Used by encode_form_data() to preview a widget.

since: 5.8.0
param: string    $widget   The widget's PHP class name (see class-wp-widget.php).
param: array     $instance Widget instance settings.
return: string

get_widget_form( $widget_object, $instance )   X-Ref
Returns the output of WP_Widget::form() when called with the provided
instance. Used by encode_form_data() to preview a widget's form.

since: 5.8.0
param: WP_Widget $widget_object Widget object to call widget() on.
param: array     $instance Widget instance settings.
return: string

get_collection_params()   X-Ref
Retrieves the query params for collections.

since: 5.8.0
return: array Collection parameters.



Generated: Wed Oct 27 01:00:04 2021 Cross-referenced by PHPXref 0.7.1