Opened 6 years ago
Closed 6 years ago
#45112 closed task (blessed) (fixed)
Integrate meta box support for the new editor
Reported by: | desrosj | Owned by: | |
---|---|---|---|
Milestone: | 5.0 | Priority: | normal |
Severity: | normal | Version: | |
Component: | Options, Meta APIs | Keywords: | has-patch fixed-5.0 |
Focuses: | Cc: |
Description
Meta box functionality for the new editor exists in gutenberg/lib/meta-box-partial-page.php
. This should exist in WordPress Core.
Attachments (4)
Change History (40)
#3
@
6 years ago
Just a notice that we're doing small tweaks in this PR https://github.com/WordPress/gutenberg/pull/10676
In case anyone already started doing a patch.
#4
@
6 years ago
- Keywords has-patch added; needs-patch removed
45112.diff is a first pass at adding meta box support. It needs unit tests added, and testing in conjunction with the patch on #45037.
#8
@
6 years ago
- Keywords fixed-5.0 added; needs-unit-tests removed
Meta box support has been ported.
#9
@
6 years ago
@pento Was there a reason for not using 45112.2.diff?
This ticket was mentioned in Slack in #core by timothybjacobs. View the logs.
6 years ago
#15
follow-up:
↓ 16
@
6 years ago
Adding to this, I think it should really only run on post type screens as opposed to whitelisting the dashboard. I know I've used the meta box API for completely custom admin pages, I'm sure others have as well.
#16
in reply to:
↑ 15
@
6 years ago
Replying to TimothyBlynJacobs:
Adding to this, I think it should really only run on post type screens as opposed to whitelisting the dashboard. I know I've used the meta box API for completely custom admin pages, I'm sure others have as well.
+1 to this. We also use the metabox API on custom admin pages.
This ticket was mentioned in Slack in #core-editor by youknowriad. View the logs.
6 years ago
#20
@
6 years ago
In the 5.0 beta.1, the meta boxes registered from the theme are not displayed, It works correctly when Gutenberg plugin is activated.
To reproduce
- install WP 5.0 beta.1 on a fresh site and install any theme that registers a meta box (example - Astra)
The meta box will not be displayed in the block editor.
- Install and activate Gutenberg from the plugin repository and the meta boxes will be displayed now.
#21
@
6 years ago
Upon some debugging it seems action do_action( 'add_meta_boxes', $post_type, $post );
is not fired inside the block editor.
Whe gutenberg is activated it gets fired from gutenberg_collect_meta_box_data()
- https://github.com/WordPress/gutenberg/blob/master/lib/register.php#L172
#23
@
6 years ago
45112.3.diff fires the action add_meta_boxes
before the the_block_editor_meta_boxes()
is called in /src/wp-admin/edit-form-blocks.php
.
#27
follow-up:
↓ 32
@
6 years ago
The error message appears to be triggered on dashboard widgets as well, as reported above and here:
[43830] does not solve the problem.
Since wp_add_dashboard_widget
uses add_meta_box
here, should __block_editor_compatible_meta_box
be set to false
in that meta box's $callback_args
to solve the issue for all dashboard widgets? I don't believe any dashboard widget is meant to support the block editor yet.
#28
follow-up:
↓ 31
@
6 years ago
Without Gutenberg activated, I'm seeing all the default meta boxes in the Advanced Panels section, see advanced-panels.png. Can someone confirm?
This ticket was mentioned in Slack in #core-editor by ocean90. View the logs.
6 years ago
#30
@
6 years ago
Without Gutenberg activated, I'm seeing all the default meta boxes in the Advanced Panels section, see advanced-panels.png. Can someone confirm?
I can reproduce it with the current beta2.
#31
in reply to:
↑ 28
@
6 years ago
Replying to ocean90:
Without Gutenberg activated, I'm seeing all the default meta boxes in the Advanced Panels section, see advanced-panels.png. Can someone confirm?
Yes, that looks like a bug. I've created #45249 to track it. Thanks!
#32
in reply to:
↑ 27
@
6 years ago
Replying to jeherve:
The error message appears to be triggered on dashboard widgets as well, as reported above and here:
[43830] does not solve the problem.
Since
wp_add_dashboard_widget
usesadd_meta_box
here, should__block_editor_compatible_meta_box
be set tofalse
in that meta box's$callback_args
to solve the issue for all dashboard widgets? I don't believe any dashboard widget is meant to support the block editor yet.
To close the loop, it seems that this was fixed in [43856].
I have one question about the approach. Do you want this as a class to contain all functionality? Or should it be done the same way it has been done in
gutenberg/lib/meta-box-partial-page.php
?