WP_REST_Widget_Types_Controller::get_widget_form( WP_Widget $widget_object, array $instance )

This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.

Returns the output of WP_Widget::form() when called with the provided instance. Used by encode_form_data() to preview a widget’s form.

Parameters

$widget_object

(WP_Widget) (Required) Widget object to call widget() on.

$instance

(array) (Required) Widget instance settings.

Return

(string)

Source

File: wp-includes/rest-api/endpoints/class-wp-rest-widget-types-controller.php

private function get_widget_form( $widget_object, $instance ) {
		ob_start();

		/** This filter is documented in wp-includes/class-wp-widget.php */
		$instance = apply_filters(
			'widget_form_callback',
			$instance,
			$widget_object
		);

		if ( false !== $instance ) {
			$return = $widget_object->form( $instance );

			/** This filter is documented in wp-includes/class-wp-widget.php */
			do_action_ref_array(
				'in_widget_form',
				array( &$widget_object, &$return, $instance )
			);
		}

		return ob_get_clean();
	}

Changelog

Version Description
5.8.0 Introduced.

© 2003–2021 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wp_rest_widget_types_controller/get_widget_form