WP_Block_Type::get_variations
Get block variations.
Method of the class: WP_Block_Type{}
Hooks from the method
Returns
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() WP Block Type::get variations code WP 6.9
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 );
}