WP_Theme_JSON::get_valid_block_style_variations()protected staticWP 6.6.0

Collects valid block style variations keyed by block type.

Method of the class: WP_Theme_JSON{}

No Hooks.

Return

Array. Valid block style variations by block type.

Usage

$result = WP_Theme_JSON::get_valid_block_style_variations();

Changelog

Since 6.6.0 Introduced.

WP_Theme_JSON::get_valid_block_style_variations() code WP 6.6.2

protected static function get_valid_block_style_variations() {
	$valid_variations = array();
	foreach ( self::get_blocks_metadata() as $block_name => $block_meta ) {
		if ( ! isset( $block_meta['styleVariations'] ) ) {
			continue;
		}
		$valid_variations[ $block_name ] = array_keys( $block_meta['styleVariations'] );
	}

	return $valid_variations;
}