WP_REST_Block_Renderer_Controller::get_item_schema

Advertisement

Summery Summery

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

Syntax Syntax

WP_REST_Block_Renderer_Controller::get_item_schema()

Return Return

(array) Item schema data.

Source Source

File: wp-includes/rest-api/endpoints/class-wp-rest-block-renderer-controller.php

		// Create an array representation simulating the output of parse_blocks.
		$block = array(
			'blockName'    => $request['name'],
			'attrs'        => $attributes,
			'innerHTML'    => '',
			'innerContent' => array(),
		);

		// Render using render_block to ensure all relevant filters are used.
		$data = array(
			'rendered' => render_block( $block ),
		);

		return rest_ensure_response( $data );
	}

	/**
	 * Retrieves block's output schema, conforming to JSON Schema.
	 *
	 * @since 5.0.0
	 *

Advertisement

Changelog Changelog

Changelog
Version Description
5.0.0 Introduced.

Advertisement

Leave a Reply