WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru
функция не описана

WP_REST_Widgets_Controller::get_item_schema() public WP 5.8.0

Retrieves the widget's schema, conforming to JSON Schema.

{} Это метод класса: WP_REST_Widgets_Controller{}

Хуков нет.

Возвращает

Массив. Item schema data.

Использование

$WP_REST_Widgets_Controller = new WP_REST_Widgets_Controller();
$WP_REST_Widgets_Controller->get_item_schema();

Список изменений

С версии 5.8.0 Введена.

Код WP_REST_Widgets_Controller::get_item_schema() WP 5.8.1

public function get_item_schema() {
	if ( $this->schema ) {
		return $this->add_additional_fields_schema( $this->schema );
	}

	$this->schema = array(
		'$schema'    => 'http://json-schema.org/draft-04/schema#',
		'title'      => 'widget',
		'type'       => 'object',
		'properties' => array(
			'id'            => array(
				'description' => __( 'Unique identifier for the widget.' ),
				'type'        => 'string',
				'context'     => array( 'view', 'edit', 'embed' ),
			),
			'id_base'       => array(
				'description' => __( 'The type of the widget. Corresponds to ID in widget-types endpoint.' ),
				'type'        => 'string',
				'context'     => array( 'view', 'edit', 'embed' ),
			),
			'sidebar'       => array(
				'description' => __( 'The sidebar the widget belongs to.' ),
				'type'        => 'string',
				'default'     => 'wp_inactive_widgets',
				'required'    => true,
				'context'     => array( 'view', 'edit', 'embed' ),
			),
			'rendered'      => array(
				'description' => __( 'HTML representation of the widget.' ),
				'type'        => 'string',
				'context'     => array( 'view', 'edit', 'embed' ),
				'readonly'    => true,
			),
			'rendered_form' => array(
				'description' => __( 'HTML representation of the widget admin form.' ),
				'type'        => 'string',
				'context'     => array( 'edit' ),
				'readonly'    => true,
			),
			'instance'      => array(
				'description' => __( 'Instance settings of the widget, if supported.' ),
				'type'        => 'object',
				'context'     => array( 'view', 'edit', 'embed' ),
				'default'     => null,
				'properties'  => array(
					'encoded' => array(
						'description' => __( 'Base64 encoded representation of the instance settings.' ),
						'type'        => 'string',
						'context'     => array( 'view', 'edit', 'embed' ),
					),
					'hash'    => array(
						'description' => __( 'Cryptographic hash of the instance settings.' ),
						'type'        => 'string',
						'context'     => array( 'view', 'edit', 'embed' ),
					),
					'raw'     => array(
						'description' => __( 'Unencoded instance settings, if supported.' ),
						'type'        => 'object',
						'context'     => array( 'view', 'edit', 'embed' ),
					),
				),
			),
			'form_data'     => array(
				'description' => __( 'URL-encoded form data from the widget admin form. Used to update a widget that does not support instance. Write only.' ),
				'type'        => 'string',
				'context'     => array(),
				'arg_options' => array(
					'sanitize_callback' => function( $string ) {
						$array = array();
						wp_parse_str( $string, $array );
						return $array;
					},
				),
			),
		),
	);

	return $this->add_additional_fields_schema( $this->schema );
}