WP_Block_Type::get_variations()publicWP 6.5.0

Get block variations.

Method of the class: WP_Block_Type{}

Hooks from the method

Return

Array[].

Usage

$WP_Block_Type = new WP_Block_Type();
$WP_Block_Type->get_variations();

Changelog

Since 6.5.0 Introduced.

WP_Block_Type::get_variations() code WP 6.7.1

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