WP_REST_Block_Renderer_Controller::get_item_schema()publicWP 5.0.0

Retrieves block's output schema, conforming to JSON Schema.

Method of the class: WP_REST_Block_Renderer_Controller{}

No Hooks.

Return

Array. Item schema data.

Usage

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

Changelog

Since 5.0.0 Introduced.

WP_REST_Block_Renderer_Controller::get_item_schema() code WP 6.4.3

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

	$this->schema = array(
		'$schema'    => 'http://json-schema.org/schema#',
		'title'      => 'rendered-block',
		'type'       => 'object',
		'properties' => array(
			'rendered' => array(
				'description' => __( 'The rendered block.' ),
				'type'        => 'string',
				'required'    => true,
				'context'     => array( 'edit' ),
			),
		),
	);

	return $this->schema;
}