Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Theme JSON: replace top-level background style objects on merge #66656

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions backport-changelog/6.8/7697.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
https://github.com/WordPress/wordpress-develop/pull/7697

* https://github.com/WordPress/gutenberg/pull/66656
4 changes: 4 additions & 0 deletions lib/class-wp-theme-json-gutenberg.php
Original file line number Diff line number Diff line change
Expand Up @@ -3297,6 +3297,10 @@ public function merge( $incoming ) {
array(),
array( 'include_node_paths_only' => true )
);

// Add top-level styles.
$style_nodes[] = array( 'path' => array( 'styles' ) );

foreach ( $style_nodes as $style_node ) {
$path = $style_node['path'];
/*
Expand Down
11 changes: 8 additions & 3 deletions phpunit/class-wp-theme-json-test.php
Original file line number Diff line number Diff line change
Expand Up @@ -2301,7 +2301,9 @@ public function test_merge_incoming_background_styles() {
'styles' => array(
'background' => array(
'backgroundImage' => array(
'url' => 'http://example.org/quote.png',
'id' => 'uploaded',
'source' => 'file',
'url' => 'http://example.org/quote.png',
),
'backgroundSize' => 'cover',
),
Expand Down Expand Up @@ -2333,7 +2335,10 @@ public function test_merge_incoming_background_styles() {
'version' => WP_Theme_JSON_Gutenberg::LATEST_SCHEMA,
'styles' => array(
'background' => array(
'backgroundSize' => 'contain',
'backgroundImage' => array(
'url' => 'http://example.org/site.png',
),
'backgroundSize' => 'contain',
),
'blocks' => array(
'core/group' => array(
Expand Down Expand Up @@ -2363,7 +2368,7 @@ public function test_merge_incoming_background_styles() {
'styles' => array(
'background' => array(
'backgroundImage' => array(
'url' => 'http://example.org/quote.png',
'url' => 'http://example.org/site.png',
),
'backgroundSize' => 'contain',
),
Expand Down
Loading