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

Editor: Fix missing frontend section presets output. #3322

Conversation

jorgefilipecosta
Copy link
Member

Backports PHP changes in WordPress/gutenberg#42124 to the core. Adds the missing mechanism to output frontend styles of block level presets to the core. Props mcsf, oandregal, dmsnell, draganescu.
See #56467.

Testing

Paste the following code on a post:

<!-- wp:group {"settings":{"blocks":{"core/social-links":{"color":{"palette":{"custom":[{"slug":"button-red","color":"red","name":"button red"},{"slug":"button-blue","color":"blue","name":"button blue"}]}}}},"color":{"palette":{"custom":[{"slug":"global-aquamarine","color":"aquamarine","name":"Global aquamarine"},{"slug":"global-pink","color":"pink","name":"Global Pink"}]}}}} -->
<div class="wp-block-group"><!-- wp:paragraph -->
<p>Leaf paragraph of inner group block.</p>
<!-- /wp:paragraph -->

<!-- wp:social-links {"iconBackgroundColor":"button-red","iconBackgroundColorValue":"red","showLabels":true} -->
<ul class="wp-block-social-links has-visible-labels has-icon-background-color"><!-- wp:social-link {"url":"w.org","service":"wordpress","label":"red"} /--></ul>
<!-- /wp:social-links -->

<!-- wp:social-links {"iconBackgroundColor":"button-blue","iconBackgroundColorValue":"blue","showLabels":true} -->
<ul class="wp-block-social-links has-visible-labels has-icon-background-color"><!-- wp:social-link {"url":"w.org","service":"wordpress","label":"blue"} /--></ul>
<!-- /wp:social-links -->

<!-- wp:paragraph {"backgroundColor":"global-aquamarine"} -->
<p class="has-global-aquamarine-background-color has-background">global-aquamarine</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph {"backgroundColor":"global-pink"} -->
<p class="has-global-pink-background-color has-background">global-pink</p>
<!-- /wp:paragraph --></div>
<!-- /wp:group -->

Verify the front-end result is:
image

Backports PHP changes in WordPress/gutenberg#42124 to the core. Adds the missing mechanism to output frontend styles of block level presets to the core.
Props mcsf, oandregal, dmsnell, draganescu.
See #56467.
@jorgefilipecosta
Copy link
Member Author

Committed in 2b1febd.

@ockham
Copy link
Contributor

ockham commented Sep 26, 2022

Unfortunately, this seems to cause a fatal when the current stable version of the Gutenberg plugin is enabled:

Warning: Declaration of WP_Theme_JSON_6_1::get_stylesheet($types = Array, $origins = NULL) should be compatible with WP_Theme_JSON::get_stylesheet($types = Array, $origins = NULL, $options = Array) in /var/www/src/wp-content/plugins/gutenberg/lib/compat/wordpress-6.1/class-wp-theme-json-6-1.php on line 630

@jorgefilipecosta Could you revert this for now? We need to figure out a way that's compatible with the GB plugin 🙂

@ockham
Copy link
Contributor

ockham commented Sep 26, 2022

Update: Jorge reverted this in decd946. Thank you!

He also mentioned that we'll need to coordinate landing this with a Gutenberg release that includes the updated function signature. I believe that's WordPress/gutenberg#42124.

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