wpseek.com
A WordPress-centric search engine for devs and theme authors
wp_register_block_style_variations_from_theme_json_partials is private and should not be used in themes or plugins directly.
wp_register_block_style_variations_from_theme_json_partials › WordPress Function
Since6.6.0
Deprecatedn/a
› wp_register_block_style_variations_from_theme_json_partials ( $variations )
Access: |
|
Parameters: |
|
Defined at: | |
Codex: |
Registers block style variations read in from theme.json partials.
Source
function wp_register_block_style_variations_from_theme_json_partials( $variations ) { if ( empty( $variations ) ) { return; } $registry = WP_Block_Styles_Registry::get_instance(); foreach ( $variations as $variation ) { if ( empty( $variation['blockTypes'] ) || empty( $variation['styles'] ) ) { continue; } $variation_name = $variation['slug'] ?? _wp_to_kebab_case( $variation['title'] ); $variation_label = $variation['title'] ?? $variation_name; foreach ( $variation['blockTypes'] as $block_type ) { $registered_styles = $registry->get_registered_styles_for_block( $block_type ); // Register block style variation if it hasn't already been registered. if ( ! array_key_exists( $variation_name, $registered_styles ) ) { register_block_style( $block_type, array( 'name' => $variation_name, 'label' => $variation_label, ) ); } } } }