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

Render presets coming from the settings of a section #40683

Closed
wants to merge 6 commits into from

Conversation

oandregal
Copy link
Member

@oandregal oandregal commented Apr 28, 2022

What?

This PR renders the presets coming from a section (a block instance). Follow-up to #40547 (depends on it).

Why?

We want to create the concept of a "section" that is able hold settings & styles (like theme.json does) but in block instances. See #40318 and #39281

We need the ability for the presets defined in this sections to be rendered.

How?

This adds the settings as a block support in the server.

Testing Instructions

  • Create a new post and open the code editor.
  • Paste the following content:
<!-- wp:group {"settings":{"color":{"defaultPalette":false,"palette":{"custom":[{"slug":"my-hotpink","color":"hotpink","name":"Hotpink"}]}}}} -->
<div class="wp-block-group"><!-- wp:paragraph -->
<p>Leaf paragraph of top-level group block.</p>
<!-- /wp:paragraph -->

<!-- wp:group {"settings":{"color":{"palette":{"custom":[{"slug":"my-aquamarine","color":"aquamarine","name":"Aquamarine"}]}}}} -->
<div class="wp-block-group"><!-- wp:paragraph -->
<p>Leaf paragraph of inner group block.</p>
<!-- /wp:paragraph --></div>
<!-- /wp:group --></div>
<!-- /wp:group -->
  • Go to the front and verify that there's a new inline styles with the following contents:
body {--wp--preset--color--my-hotpink: hotpink; }
.has-my-hotpink-color { color: var(--wp--preset--color--my-hotpink) !important; }
.has-my-hotpink-background-color { background-color: var(--wp--preset--color--my-hotpink) !important; }
.has-my-hotpink-border-color { border-color: var(--wp--preset--color--my-hotpink) !important; }

TODO

This PR is in bootstrap state. It needs to be updated for the styles generated to be in line with this conversation #40547 (comment)

This was referenced Apr 28, 2022
@oandregal oandregal self-assigned this Apr 28, 2022
@oandregal oandregal added the [Status] In Progress Tracking issues with work in progress label Apr 28, 2022
Base automatically changed from try/settings-at-block to trunk April 29, 2022 10:02
@oandregal
Copy link
Member Author

This needs more work than anticipated and I won't be able to take it. Closing this draft as to invite others to start from a blank slate.

@oandregal oandregal closed this Apr 29, 2022
@oandregal oandregal deleted the add/render-presets-from-section-settings branch April 29, 2022 11:12
@priethor priethor removed the [Status] In Progress Tracking issues with work in progress label Jan 11, 2023
@glendaviesnz glendaviesnz restored the add/render-presets-from-section-settings branch August 14, 2023 04:28
@glendaviesnz glendaviesnz deleted the add/render-presets-from-section-settings branch August 14, 2023 04:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants