Skip to content

Commit

Permalink
Backport changes from Core patch: WordPress/wordpress-develop#7670
Browse files Browse the repository at this point in the history
Wrap array_merge in a conditional to prevent unnecessary firing.
  • Loading branch information
ramonjd committed Nov 1, 2024
1 parent fbdc0f9 commit 3d3a554
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions packages/style-engine/class-wp-style-engine.php
Original file line number Diff line number Diff line change
Expand Up @@ -424,8 +424,15 @@ public static function parse_block_styles( $block_styles, $options ) {
continue;
}

$parsed_styles['classnames'] = array_merge( $parsed_styles['classnames'], static::get_classnames( $style_value, $style_definition ) );
$parsed_styles['declarations'] = array_merge( $parsed_styles['declarations'], static::get_css_declarations( $style_value, $style_definition, $options ) );
$classnames = static::get_classnames( $style_value, $style_definition );
if ( ! empty( $classnames ) ) {
$parsed_styles['classnames'] = array_merge( $parsed_styles['classnames'], $classnames );
}

$css_declarations = static::get_css_declarations( $style_value, $style_definition, $options );
if ( ! empty( $css_declarations ) ) {
$parsed_styles['declarations'] = array_merge( $parsed_styles['declarations'], $css_declarations );
}
}
}

Expand Down

0 comments on commit 3d3a554

Please sign in to comment.