[ Index ] |
PHP Cross Reference of WordPress Trunk (Updated Daily) |
[Source view] [Print] [Project Stats]
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 |
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. 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. 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. 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. 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. 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. return: array Array of widgets. |
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. |
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. |
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. |
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. 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. 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. param: WP_Widget $widget_object Widget object to call widget() on. param: array $instance Widget instance settings. return: string |
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. |
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. |
get_collection_params() X-Ref |
Retrieves the query params for collections. return: array Collection parameters. |
Generated : Thu Nov 21 08:20:01 2024 | Cross-referenced by PHPXref |