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

Conditionally include the block styles functionality #17429

Merged

Conversation

@jorgefilipecosta
Copy link
Member

commented Sep 13, 2019

Description

This PR conditionally includes block styles server functionalityin the plugin.
This functionality will be added to core and also including it in the plugin would cause errors.

How has this been tested?

I applied the WordPress patch available on https://core.trac.wordpress.org/ticket/47843 to the test environment.
I enabled the plugin in this branch and verified there are no errors.
I added the following code to the functions.php file of the enabled theme and verified styles were registered as expected:

add_action(
	'enqueue_block_assets',
	function() {
		wp_register_style( 'myguten-style', get_template_directory_uri() . '/custom-style.css' );
	}
);

register_block_style(
	'core/quote',
	array(
		'name'         => 'fancy-quote',
		'label'        => 'Fancy Quote',
		'style_handle' => 'myguten-style',
	)
);

register_block_style(
	'core/quote',
	array(
		'name'         => 'not-fancy-quote',
		'label'        => 'Not Fancy Quote',
		'inline_style' => '.wp-block-quote.is-style-not-fancy-quote { color: blue; }',
	)
);

register_block_style(
	'core/quote',
	array(
		'name'         => 'unregistered-fancy-quote',
		'label'        => 'Unregistered Fancy Quote',
		'inline_style' => '.wp-block-quote.is-style-unregistered-fancy-quote { color: orange; }',
	)
);
unregister_block_style( 'core/quote', 'unregistered-fancy-quote' );
@gziolo
gziolo approved these changes Sep 13, 2019
Copy link
Member

left a comment

Awesome work 👍

@gziolo gziolo merged commit 33ad5ac into master Sep 13, 2019
4 of 7 checks passed
4 of 7 checks passed
pull-request-automation
Details
Header rules - gutenberg-playground No header rules processed
Details
Pages changed - gutenberg-playground 5 new files uploaded
Details
Redirect rules - gutenberg-playground No redirect rules processed
Details
Mixed content - gutenberg-playground No mixed content detected
Details
Travis CI - Pull Request Build Passed
Details
netlify/gutenberg-playground/deploy-preview Deploy preview ready!
Details
@gziolo gziolo deleted the update/conditionally-include-the-block-styles-functionality branch Sep 13, 2019
@gziolo gziolo added this to the Gutenberg 6.5 milestone Sep 13, 2019
@kraftbj

This comment has been minimized.

Copy link

commented Sep 17, 2019

Noting that anyone running Trunk with the stable version of the plugin are fataling until this is shipped out. https://core.trac.wordpress.org/ticket/48039#comment:6

@gziolo

This comment has been minimized.

Copy link
Member

commented Sep 19, 2019

This should be fixed now with Gutenberg 6.5. It was unfortunate that we backported it to WordPress core before waiting for the plugin to be released.

dd32 pushed a commit to dd32/gutenberg that referenced this pull request Sep 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.