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

Background block supports: add support for top-level styles in theme.json #6482

Closed

Conversation

ramonjd
Copy link
Member

@ramonjd ramonjd commented May 2, 2024

Syncing Gutenberg PRs:

Trac ticket: https://core.trac.wordpress.org/ticket/61123

How to test

This PR enables top-level background images. You can:

  1. Add a site background image in theme.json:
{
	"$schema": "https://schemas.wp.org/trunk/theme.json",
	"version": 2,
	"settings": {
		"appearanceTools": true
	},
	"styles": {
		"background": {
			"backgroundImage": {
				"url": "https://images.pexels.com/photos/22484288/pexels-photo-22484288/free-photo-of-the-circular-stone-terraces-of-the-inca-ruins.jpeg"
			},
                        "backgroundSize": "cover"
		}
	}
}
  1. Or upload/add your own background image in the site editor global styles sidebar.
2024-05-28.12.11.42.mp4
Screenshot 2024-05-08 at 12 51 17 pm

Copy link

github-actions bot commented May 2, 2024

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 props-bot label.

Core Committers: Use this line as a base for the props when committing in SVN:

Props ramonopoly, noisysocks.

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

Copy link

github-actions bot commented May 2, 2024

Test using WordPress Playground

The 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

  • The Plugin and Theme Directories cannot be accessed within Playground.
  • All changes will be lost when closing a tab with a Playground instance.
  • All changes will be lost when refreshing the page.
  • A fresh instance is created each time the link below is clicked.
  • Every time this pull request is updated, a new ZIP file containing all changes is created. If changes are not reflected in the Playground instance,
    it's possible that the most recent build failed, or has not completed. Check the list of workflow runs to be sure.

For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation.

Test this pull request with WordPress Playground.

@ramonjd ramonjd force-pushed the add/background-image-top-level-styles branch from 6305245 to 02b410a Compare May 3, 2024 04:19
@ramonjd ramonjd changed the title WIP Background block supports: add support for top-level styles in theme.json Background block supports: add support for top-level styles in theme.json May 3, 2024
@ramonjd ramonjd force-pushed the add/background-image-top-level-styles branch 2 times, most recently from b1f04ae to 84b6c19 Compare May 8, 2024 02:44
@ramonjd ramonjd force-pushed the add/background-image-top-level-styles branch from 84b6c19 to cf2da5e Compare May 26, 2024 22:41
Syncing changes for
Global styles: background UI controls #59454
Global styles: add background image to top-level theme.json styles #59354
Background block supports: move block support defaults to gutenberg_render_background_support and revert gutenberg_get_background_support_styles #59889
@ramonjd ramonjd force-pushed the add/background-image-top-level-styles branch from cf2da5e to a0a496d Compare May 28, 2024 02:03
Copy link
Member

@noisysocks noisysocks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Took this branch for a spin without the Gutenberg plugin activated. I tested setting a background image via Global Styles on TT4 and creating a new theme with Create Block Theme, setting a background via Global Styles, and then saving those changes to theme.json. All worked as expected.

LGTM but maybe fix up that ?? since I think we're not supposed to use them. (I can't actually remember.)

src/wp-includes/class-wp-theme-json.php Show resolved Hide resolved
src/wp-includes/class-wp-theme-json.php Outdated Show resolved Hide resolved
Copy link
Member

@noisysocks noisysocks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good 👍 – do you need me to commit?

@ramonjd
Copy link
Member Author

ramonjd commented May 28, 2024

Looking good 👍 – do you need me to commit?

Thank you!! Yes please! I have pleb rights.

@noisysocks noisysocks closed this May 28, 2024
@noisysocks
Copy link
Member

noisysocks commented May 28, 2024

Committed in r58222.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
2 participants