WP_Block_Type::get_variations(): array[]

In this article

Get block variations.

Return

array[]

Source

public function get_variations() {
	if ( ! isset( $this->variations ) ) {
		$this->variations = array();
		if ( is_callable( $this->variation_callback ) ) {
			$this->variations = call_user_func( $this->variation_callback );
		}
	}

	/**
	 * Filters the registered variations for a block type.
	 *
	 * @since 6.5.0
	 *
	 * @param array         $variations Array of registered variations for a block type.
	 * @param WP_Block_Type $block_type The full block type object.
	 */
	return apply_filters( 'get_block_type_variations', $this->variations, $this );
}

Hooks

apply_filters( ‘get_block_type_variations’, array $variations, WP_Block_Type $block_type )

Filters the registered variations for a block type.

Changelog

VersionDescription
6.5.0Introduced.

User Contributed Notes

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