WP_Block_List::__construct( array[]|WP_Block[] $blocks, array $available_context = array(), WP_Block_Type_Registry $registry = null )

Constructor.

Description

Populates object properties from the provided block instance argument.

Parameters

$blocksarray[]|WP_Block[]required
Array of parsed block data, or block instances.
$available_contextarrayoptional
Optional array of ancestry context values.

Default:array()

$registryWP_Block_Type_Registryoptional
Optional block type registry.

Default:null

Source

public function __construct( $blocks, $available_context = array(), $registry = null ) {
	if ( ! $registry instanceof WP_Block_Type_Registry ) {
		$registry = WP_Block_Type_Registry::get_instance();
	}

	$this->blocks            = $blocks;
	$this->available_context = $available_context;
	$this->registry          = $registry;
}

Changelog

VersionDescription
5.5.0Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.