[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

Search

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: 674 lines (19 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

WP_REST_Widget_Types_Controller:: (18 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()
  render()
  render_legacy_widget_preview_iframe()
  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.


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


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

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

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

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

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

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

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

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.

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

get_widgets()   X-Ref
Normalize array of widgets.

return: array Array of widgets.

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

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

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

return: WP_REST_Response Widget type data.
param: array           $item    Widget type data.
param: WP_REST_Request $request Full details about the request.

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

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

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

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.

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

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.

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

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.

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

render( $request )   X-Ref
Renders a single Legacy Widget and wraps it in a JSON-encodable array.

return: array An array with rendered Legacy Widget HTML.
param: WP_REST_Request $request Full details about the request.

render_legacy_widget_preview_iframe( $id_base, $instance )   X-Ref
Renders a page containing a preview of the requested Legacy Widget block.

return: string Rendered Legacy Widget block preview.
param: string $id_base The id base of the requested widget.
param: array  $instance The widget instance attributes.

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

return: array Collection parameters.



Generated : Sat Dec 21 08:20:01 2024 Cross-referenced by PHPXref