-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Background image: add support for relative theme path URLs in top-level theme.json styles #6608
Background image: add support for relative theme path URLs in top-level theme.json styles #6608
Conversation
Test using WordPress PlaygroundThe changes in this pull request can previewed and tested using a WordPress Playground instance. WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser. Some things to be aware of
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
I created a local branch containing this PR and #6482 and, with the Gutenberg plugin disabled, I tested creating a new block theme that uses a local I think you're missing this change: |
Ah, nice spotting. Thanks! 🙇🏻 I'll update and push quickly. TBH I'd stopped working on this in anticipation of #6482 getting in first. |
80c5082
to
4c974ce
Compare
You asked me to test these two PRs so, ready or not, I'm testing these two PRs 😛 |
🍺 You got me. 😄 |
5c94e13
to
6189bff
Compare
src/wp-includes/rest-api/endpoints/class-wp-rest-global-styles-revisions-controller.php
Show resolved
Hide resolved
6189bff
to
edbc18d
Compare
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Core Committers: Use this line as a base for the props when committing in SVN:
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code looks correctly ported to me—just a few small things to fix.
I tested this by creating a new empty theme and using a relative URL in background.backgroundImage.url
and all was well.
src/wp-includes/rest-api/endpoints/class-wp-rest-global-styles-controller.php
Outdated
Show resolved
Hide resolved
src/wp-includes/rest-api/endpoints/class-wp-rest-global-styles-revisions-controller.php
Outdated
Show resolved
Hide resolved
src/wp-includes/rest-api/endpoints/class-wp-rest-global-styles-revisions-controller.php
Show resolved
Hide resolved
src/wp-includes/rest-api/endpoints/class-wp-rest-global-styles-revisions-controller.php
Outdated
Show resolved
Hide resolved
Co-authored-by: Robert Anderson <robert@noisysocks.com>
Co-authored-by: Robert Anderson <robert@noisysocks.com>
Simplifying links array building in revisions controller
…s to be set to something to be useful.
Looking good. Would you mind adding step-by-step instructions for how to test the changes to |
Thanks! LGTM 👍 |
Committed in r58262. |
* | ||
* @since 6.6.0 | ||
* | ||
* @param WP_Theme_JSON $theme_json A theme json instance. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove space before variable
|
||
/* | ||
* The same file convention when registering web fonts. | ||
* See: WP_Font_Face_Resolver:: to_theme_file_uri. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove space.
What
This PR syncs the PHP changes from:
Testing
Important
Until the latest Gutenberg packages are synced, the editor won't parse the relative paths correctly.
I'm using twentytwentyfour to test.
In the theme.json for that theme, add the following to the "styles" object:
Next, add a background image to a style variations, for example
src/wp-content/themes/twentytwentyfour/styles/ember.json
Check the frontend to ensure the correct image is displayed in the background:
Now head over to the site editor and enable the ember variation under Styles > Browse styles. Save and check the frontend.
Ensure the correct image displays (the one from the variation ember.json above).
You can check that
_links
is added correctly to the REST response through the core data selectors in the browser's console.To do that, head back to the site editor and open the browser console.
Check that user styles has a
_links
entry with theme-uris. It should if you saved the switch to the ember variation.Check that the Ember item has a
_links
entry with theme-uris.Check that the latest revision (the one where you saved the Ember variation) item has a
_links
entry with theme-uris.Trac ticket: https://core.trac.wordpress.org/ticket/61273
This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.