WordPress at a glance
function is not described

WP_REST_Block_Renderer_Controller::get_item() public WP 5.0.0

Returns block output from block's registered render_callback.

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

No Hooks.

Return

WP_REST_Response/WP_Error. Response object on success, or WP_Error object on failure.

Usage

$WP_REST_Block_Renderer_Controller = new WP_REST_Block_Renderer_Controller();
$WP_REST_Block_Renderer_Controller->get_item( $request );
$request(WP_REST_Request) (required)
Full details about the request.

Changelog

Since 5.0.0 Introduced.

Code of WP_REST_Block_Renderer_Controller::get_item() WP 5.5.1

<?php
public function get_item( $request ) {
	global $post;

	$post_id = isset( $request['post_id'] ) ? intval( $request['post_id'] ) : 0;

	if ( 0 < $post_id ) {
		$post = get_post( $post_id );

		// Set up postdata since this will be needed if post_id was set.
		setup_postdata( $post );
	}

	$registry   = WP_Block_Type_Registry::get_instance();
	$registered = $registry->get_registered( $request['name'] );

	if ( null === $registered || ! $registered->is_dynamic() ) {
		return new WP_Error(
			'block_invalid',
			__( 'Invalid block.' ),
			array(
				'status' => 404,
			)
		);
	}

	$attributes = $request->get_param( 'attributes' );

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