Meta boxes: Don't show the block editor incompatiblity message when it doesn't apply.

We should only be showing this message in the classic editor interface, for meta boxes that are marked as being incompatible with the block editor.

Props pento.
Merges [43839] to trunk.
Fixes #45207.

Built from https://develop.svn.wordpress.org/trunk@44175


git-svn-id: http://core.svn.wordpress.org/trunk@44005 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
atimmer 2018-12-14 09:42:53 +00:00
parent 20992de206
commit a409c41f62
2 changed files with 3 additions and 3 deletions

View File

@ -1137,6 +1137,7 @@ function do_meta_boxes( $screen, $context, $object ) {
continue; continue;
} }
$block_compatible = true;
if ( is_array( $box[ 'args' ] ) ) { if ( is_array( $box[ 'args' ] ) ) {
// If a meta box is just here for back compat, don't show it in the block editor. // If a meta box is just here for back compat, don't show it in the block editor.
if ( $screen->is_block_editor() && isset( $box['args']['__back_compat_meta_box'] ) && $box['args']['__back_compat_meta_box'] ) { if ( $screen->is_block_editor() && isset( $box['args']['__back_compat_meta_box'] ) && $box['args']['__back_compat_meta_box'] ) {
@ -1148,7 +1149,6 @@ function do_meta_boxes( $screen, $context, $object ) {
continue; continue;
} }
$block_compatible = true;
if ( isset( $box['args']['__block_editor_compatible_meta_box'] ) ) { if ( isset( $box['args']['__block_editor_compatible_meta_box'] ) ) {
$block_compatible = (bool) $box['args']['__block_editor_compatible_meta_box']; $block_compatible = (bool) $box['args']['__block_editor_compatible_meta_box'];
unset( $box['args']['__block_editor_compatible_meta_box'] ); unset( $box['args']['__block_editor_compatible_meta_box'] );
@ -1186,7 +1186,7 @@ function do_meta_boxes( $screen, $context, $object ) {
echo "</h2>\n"; echo "</h2>\n";
echo '<div class="inside">' . "\n"; echo '<div class="inside">' . "\n";
if ( WP_DEBUG && ! $screen->is_block_editor() && ! isset( $_GET['meta-box-loader'] ) ) { if ( WP_DEBUG && ! $block_compatible && 'edit' === $screen->parent_base && ! $screen->is_block_editor() && ! isset( $_GET['meta-box-loader'] ) ) {
if ( is_array( $box['callback'] ) ) { if ( is_array( $box['callback'] ) ) {
$reflection = new ReflectionMethod( $box['callback'][0], $box['callback'][1] ); $reflection = new ReflectionMethod( $box['callback'][0], $box['callback'][1] );
} elseif ( false !== strpos( $box['callback'], '::' ) ) { } elseif ( false !== strpos( $box['callback'], '::' ) ) {

View File

@ -13,7 +13,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '5.1-alpha-44174'; $wp_version = '5.1-alpha-44175';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.