W3cubDocs

/WordPress

WP_Block_List::offsetGet( string $index )

Returns the value by the specified block index.

Parameters

$index

(string) (Required) Index of block value to retrieve.

Return

(mixed|null) Block value if exists, or null.

Source

File: wp-includes/class-wp-block-list.php

public function offsetGet( $index ) {
		$block = $this->blocks[ $index ];

		if ( isset( $block ) && is_array( $block ) ) {
			$block                  = new WP_Block( $block, $this->available_context, $this->registry );
			$this->blocks[ $index ] = $block;
		}

		return $block;
	}

Changelog

Version Description
5.5.0 Introduced.

© 2003–2019 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wp_block_list/offsetget