Skip to content

Commit

Permalink
Fix merge algorithm for global styles (#24294)
Browse files Browse the repository at this point in the history
  • Loading branch information
nosolosw authored Jul 30, 2020
1 parent e4a41c8 commit da89462
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions lib/global-styles.php
Original file line number Diff line number Diff line change
Expand Up @@ -495,13 +495,20 @@ function gutenberg_experimental_global_styles_merge_trees( $core, $theme, $user
$result = gutenberg_experimental_global_styles_normalize_schema( array() );

foreach ( array_keys( $core ) as $block_name ) {
foreach ( array( 'presets', 'styles', 'features' ) as $subtree ) {
foreach ( array( 'presets', 'features' ) as $subtree ) {
$result[ $block_name ][ $subtree ] = array_merge(
$core[ $block_name ][ $subtree ],
$theme[ $block_name ][ $subtree ],
$user[ $block_name ][ $subtree ]
);
}
foreach ( array_keys( $core[ $block_name ]['styles'] ) as $subtree ) {
$result[ $block_name ]['styles'][ $subtree ] = array_merge(
$core[ $block_name ]['styles'][ $subtree ],
$theme[ $block_name ]['styles'][ $subtree ],
$user[ $block_name ]['styles'][ $subtree ]
);
}
}

return $result;
Expand All @@ -516,7 +523,10 @@ function gutenberg_experimental_global_styles_merge_trees( $core, $theme, $user
*/
function gutenberg_experimental_global_styles_normalize_schema( $tree ) {
$block_schema = array(
'styles' => array(),
'styles' => array(
'typography' => array(),
'color' => array(),
),
'features' => array(),
'presets' => array(),
);
Expand Down

0 comments on commit da89462

Please sign in to comment.