Skip to content

Commit

Permalink
Remove registration from wp_theme_json_data_* filters
Browse files Browse the repository at this point in the history
  • Loading branch information
oandregal committed Jun 10, 2024
1 parent 47cf583 commit 0db84e5
Showing 1 changed file with 0 additions and 15 deletions.
15 changes: 0 additions & 15 deletions src/wp-includes/block-supports/block-style-variations.php
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,6 @@ function wp_resolve_and_register_block_style_variations( $variations ) {
return $variations_data;
}

$registry = WP_Block_Styles_Registry::get_instance();
$have_named_variations = ! wp_is_numeric_array( $variations );

foreach ( $variations as $key => $variation ) {
Expand All @@ -254,22 +253,8 @@ function wp_resolve_and_register_block_style_variations( $variations ) {
* need to have their name set to the kebab case version of their title.
*/
$variation_name = $have_named_variations ? $key : _wp_to_kebab_case( $variation['title'] );
$variation_label = $variation['title'] ?? $variation_name;

foreach ( $supported_blocks 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,
)
);
}

// Add block style variation data under current block type.
$path = array( $block_type, 'variations', $variation_name );
_wp_array_set( $variations_data, $path, $variation_data );
Expand Down

0 comments on commit 0db84e5

Please sign in to comment.