[ Index ] |
PHP Cross Reference of WordPress |
[Source view] [Print] [Project Stats]
REST API: WP_REST_Widget_Types_Controller class
File Size: | 669 lines (19 kb) |
Included or required: | 0 times |
Referenced: | 0 times |
Includes or requires: | 0 files |
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. 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. 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. since: 5.8.0 |
get_items( $request ) X-Ref |
Retrieves the list of all widget types. 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. since: 5.8.0 |
get_item_permissions_check( $request ) X-Ref |
Checks if a given request has access to read a widget type. 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. since: 5.8.0 |
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. since: 5.8.0 |
get_widget( $id ) X-Ref |
Gets the details about the requested widget. param: string $id The widget type id. return: array|WP_Error The array of widget data if the name is valid, WP_Error otherwise. since: 5.8.0 |
get_widgets() X-Ref |
Normalize array of widgets. return: array Array of widgets. since: 5.8.0 |
get_item( $request ) X-Ref |
Retrieves a single widget type from the collection. 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. since: 5.8.0 |
prepare_item_for_response( $item, $request ) X-Ref |
Prepares a widget type object for serialization. param: array $item Widget type data. param: WP_REST_Request $request Full details about the request. return: WP_REST_Response Widget type data. since: 5.8.0 since: 5.9.0 Renamed `$widget_type` to `$item` to match parent class for PHP 8 named parameter support. |
prepare_links( $widget_type ) X-Ref |
Prepares links for the widget type. param: array $widget_type Widget type data. return: array Links for the given widget type. since: 5.8.0 |
get_item_schema() X-Ref |
Retrieves the widget type's schema, conforming to JSON Schema. return: array Item schema data. since: 5.8.0 |
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. 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. since: 5.8.0 |
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. param: string $widget The widget's PHP class name (see class-wp-widget.php). param: array $instance Widget instance settings. return: string since: 5.8.0 |
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. param: WP_Widget $widget_object Widget object to call widget() on. param: array $instance Widget instance settings. return: string since: 5.8.0 |
render( $request ) X-Ref |
Renders a single Legacy Widget and wraps it in a JSON-encodable array. param: WP_REST_Request $request Full details about the request. return: array An array with rendered Legacy Widget HTML. since: 5.9.0 |
render_legacy_widget_preview_iframe( $id_base, $instance ) X-Ref |
Renders a page containing a preview of the requested Legacy Widget block. param: string $id_base The id base of the requested widget. param: array $instance The widget instance attributes. return: string Rendered Legacy Widget block preview. since: 5.9.0 |
get_collection_params() X-Ref |
Retrieves the query params for collections. return: array Collection parameters. since: 5.8.0 |
Generated: Fri Oct 4 01:00:02 2024 | Cross-referenced by PHPXref 0.7.1 |