WordPress at a glance
function is not described

WP_REST_Block_Types_Controller::get_block() protected WP 5.5.0

Get the block, if the name is valid.

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

No Hooks.

Return

WP_Block_Type/WP_Error. Block type object if name is valid, WP_Error otherwise.

Usage

// protected - for code of main (parent) or child class
$result = $this->get_block( $name );
$name(string) (required)
Block name.

Changelog

Since 5.5.0 Introduced.

Code of WP_REST_Block_Types_Controller::get_block() WP 5.5.2

<?php
protected function get_block( $name ) {
	$block_type = $this->block_registry->get_registered( $name );
	if ( empty( $block_type ) ) {
		return new WP_Error( 'rest_block_type_invalid', __( 'Invalid block type.' ), array( 'status' => 404 ) );
	}

	return $block_type;
}