-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Add register_block_patterns action #40305
Comments
With Gutenberg 13.0.0 active patterns that include blocks from our other than core blocks seem to have lost their styling. Could it be that this is related to the issue mentioned above? |
Can we create a separate issue for the patterns losing styles. It's not clear at the moment if it's the same problem. |
With this hook, it would be great to know the |
To make that work, the REST endpoint would have to have a few query params, like:
and the This used to be possible with the |
@jsnajdr |
Just to comment here that we're needing the same for Sensei LMS. |
I was investigating that in order to come with a good solution to Sensei, but I noticed that it was fixed for the final release in this commit: WordPress/WordPress@571e1e0 So should we consider it safe to be registered attached to the |
It will work but is suboptimal because the patterns registered in If you don't need to discriminate between different kinds of editor (post, site, widgets, ...) and just want to register a pattern for all, currently the best action to use is There is still need for a new |
Perhaps in a future release! I can't see this happening for 6.5 at this stage. |
This issue continues discussion that started in #36751 (comment)
To let plugin authors reliably register block patterns (and categories) at the right time, we should introduce actions called
register_block_patterns
(sync) andregister_remote_block_patterns
(async).The WordPress.com Editing Toolkit plugin currently registers new patterns on the
current_screen
action, but that stopped working with WordPress 6.0 beta 1, because patterns are now fetched from a new REST endpoint, which never callscurrent_screen
.Another thing that Editing Toolkit currently does is that it load different patterns for post editor and for site editor. It was able to detect that by looking at the
$current_screen
object. But in REST API we don't have a way to detect that. We'd have to add a new query parameter. That feature can't currently be ported to 6.0 beta 1.Does the current vanilla Gutenberg have a way to discriminate between post and site editor (and possibly other ones, like widgets, too) and offer different blocks and block patterns in the inserter?
@youknowriad @mcsf @fullofcaffeine
The text was updated successfully, but these errors were encountered: