WordPress at Your Fingertips
function is not described

WP_REST_Widget_Types_Controller::get_widget_form() private WP 5.8.0

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

{} It's a method of the class: WP_REST_Widget_Types_Controller{}

Hooks from the method

Return

String.

Usage

// private - for code of main (parent) class only
$result = $this->get_widget_form( $widget_object, $instance );
$widget_object(WP_Widget) (required)
Widget object to call widget() on.
$instance(array) (required)
Widget instance settings.

Changelog

Since 5.8.0 Introduced.

Code of WP_REST_Widget_Types_Controller::get_widget_form() WP 5.8.1

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();
}