Plugin: Deprecate metabox supports, fall back to core#13449
Plugin: Deprecate metabox supports, fall back to core#13449youknowriad merged 2 commits intomasterfrom
Conversation
| 'post' => $post->ID, | ||
| 'action' => 'edit', | ||
| 'meta-box-loader' => true, | ||
| '_wpnonce' => wp_create_nonce( 'meta-box-loader' ), |
There was a problem hiding this comment.
Is this to match the URL used in Core?
Do you think we could remove bootstraping Gutenberg entirely in the plugin (and just upgrade the scripts)
There was a problem hiding this comment.
Do you think we could remove bootstraping Gutenberg entirely in the plugin (and just upgrade the scripts)
Yes, in fact, what I've done here is simply to align the bootstrapping to exactly what core does, in order to facilitate it being dropped altogether.
| return false; | ||
| } | ||
|
|
||
| get_current_screen()->is_block_editor( true ); |
There was a problem hiding this comment.
I saw a comment on the description, but still having hard time understanding this :)
There was a problem hiding this comment.
I saw a comment on the description, but still having hard time understanding this :)
It mimics similar to what's done here:
It's important because there are conditions in core's handling of meta boxes which key off this value:
- https://github.com/WordPress/wordpress-develop/blob/8b4330bb6ea196005b5f0f84070b64c139f39b37/src/wp-admin/includes/template.php#L1242
- https://github.com/WordPress/wordpress-develop/blob/8b4330bb6ea196005b5f0f84070b64c139f39b37/src/wp-admin/includes/template.php#L1252
- https://github.com/WordPress/wordpress-develop/blob/8b4330bb6ea196005b5f0f84070b64c139f39b37/src/wp-admin/includes/template.php#L1265
- https://github.com/WordPress/wordpress-develop/blob/8b4330bb6ea196005b5f0f84070b64c139f39b37/src/wp-admin/includes/template.php#L1290
Without this, the the value of is_block_editor is false on the Gutenberg screen, which is clearly problematic irrespective of the specific meta box integration. For example, it forces plugin authors to do funny things to check whether the current screen is the block editor, regardless of whether that's the one in core or the one in the Gutenberg plugin.
There was a problem hiding this comment.
I added a clarifying comment in the rebased 4f62c93.
youknowriad
left a comment
There was a problem hiding this comment.
Seems to work as intended but given the fragility of meta boxes, I'd like a second review. Maybe @noisysocks
abe9b04 to
22f8939
Compare
22f8939 to
be024b0
Compare
* Plugin: Emulate is_block_editor for Gutenberg screen * Plugin: Deprecate metabox supports, fall back to core
* Plugin: Emulate is_block_editor for Gutenberg screen * Plugin: Deprecate metabox supports, fall back to core
Related: #11015
This pull request seeks to remove the Gutenberg-specific meta box compatibility functions, instead deferring to those shipped with WordPress 5.0.
Implementation notes:
The most tricky bit here is that we need the Gutenberg editor screen to claim itself as being the block editor, i.e.
get_current_screen()->is_block_editor(). This should be the case anyways, but since core uses this function as a condition to perform some additional logic, it requires that those equivalent bits be disabled from Gutenberg as well.From what I can gather, outside meta boxes, this impacts:
gutenberg_common_scripts_and_styles(reference)gutenberg_enqueue_registered_block_scripts_and_styles(reference)Testing instructions:
Verify that there are no regressions in the display and saving of meta boxes.