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

Plugin: Deprecate metabox supports, fall back to core #13449

Merged
merged 2 commits into from
Jan 28, 2019

Conversation

aduth
Copy link
Member

@aduth aduth commented Jan 23, 2019

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.

@aduth aduth added Gutenberg Plugin Issues or PRs related to Gutenberg Plugin management related efforts [Feature] Meta Boxes A draggable box shown on the post editing screen labels Jan 23, 2019
@aduth aduth added Good First Review A PR that's suitable for someone looking to contribute for the first time by reviewing code and removed Good First Review A PR that's suitable for someone looking to contribute for the first time by reviewing code labels Jan 23, 2019
'post' => $post->ID,
'action' => 'edit',
'meta-box-loader' => true,
'_wpnonce' => wp_create_nonce( 'meta-box-loader' ),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

https://github.com/WordPress/wordpress-develop/blob/8b4330bb6ea196005b5f0f84070b64c139f39b37/src/wp-admin/edit-form-blocks.php#L115-L126

@@ -210,6 +210,8 @@ function gutenberg_init( $return, $post ) {
return false;
}

get_current_screen()->is_block_editor( true );
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I saw a comment on the description, but still having hard time understanding this :)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added a clarifying comment in the rebased 4f62c93.

Copy link
Contributor

@youknowriad youknowriad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems to work as intended but given the fragility of meta boxes, I'd like a second review. Maybe @noisysocks

@youknowriad youknowriad added this to the 5.0 (Gutenberg) milestone Jan 25, 2019
@aduth aduth force-pushed the remove/metaboxes-supports branch 2 times, most recently from abe9b04 to 22f8939 Compare January 26, 2019 04:55
@aduth aduth removed the Good First Review A PR that's suitable for someone looking to contribute for the first time by reviewing code label Jan 28, 2019
@youknowriad youknowriad merged commit cfb269d into master Jan 28, 2019
@youknowriad youknowriad deleted the remove/metaboxes-supports branch January 28, 2019 14:23
youknowriad pushed a commit that referenced this pull request Mar 6, 2019
* Plugin: Emulate is_block_editor for Gutenberg screen

* Plugin: Deprecate metabox supports, fall back to core
youknowriad pushed a commit that referenced this pull request Mar 6, 2019
* Plugin: Emulate is_block_editor for Gutenberg screen

* Plugin: Deprecate metabox supports, fall back to core
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Meta Boxes A draggable box shown on the post editing screen Gutenberg Plugin Issues or PRs related to Gutenberg Plugin management related efforts
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants