Changeset 43779
- Timestamp:
- 10/22/2018 02:31:38 AM (5 years ago)
- Location:
- branches/5.0/src/wp-admin
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/5.0/src/wp-admin/edit-form-advanced.php
r42192 r43779 227 227 228 228 229 $publish_callback_args = null;229 $publish_callback_args = array( '__back_compat_meta_box' => true ); 230 230 if ( post_type_supports($post_type, 'revisions') && 'auto-draft' != $post->post_status ) { 231 231 $revisions = wp_get_post_revisions( $post_ID ); … … 234 234 if ( count( $revisions ) > 1 ) { 235 235 reset( $revisions ); // Reset pointer for key() 236 $publish_callback_args = array( 'revisions_count' => count( $revisions ), 'revision_id' => key( $revisions ) );237 add_meta_box('revisionsdiv', __('Revisions'), 'post_revisions_meta_box', null, 'normal', 'core' );236 $publish_callback_args = array( 'revisions_count' => count( $revisions ), 'revision_id' => key( $revisions ), '__back_compat_meta_box' => true ); 237 add_meta_box('revisionsdiv', __('Revisions'), 'post_revisions_meta_box', null, 'normal', 'core', array( '__back_compat_meta_box' => true ) ); 238 238 } 239 239 } … … 242 242 wp_enqueue_script( 'image-edit' ); 243 243 wp_enqueue_style( 'imgareaselect' ); 244 add_meta_box( 'submitdiv', __('Save'), 'attachment_submit_meta_box', null, 'side', 'core' );244 add_meta_box( 'submitdiv', __('Save'), 'attachment_submit_meta_box', null, 'side', 'core', array( '__back_compat_meta_box' => true ) ); 245 245 add_action( 'edit_form_after_title', 'edit_form_image_editor' ); 246 246 247 247 if ( wp_attachment_is( 'audio', $post ) ) { 248 add_meta_box( 'attachment-id3', __( 'Metadata' ), 'attachment_id3_data_meta_box', null, 'normal', 'core' );248 add_meta_box( 'attachment-id3', __( 'Metadata' ), 'attachment_id3_data_meta_box', null, 'normal', 'core', array( '__back_compat_meta_box' => true ) ); 249 249 } 250 250 } else { … … 253 253 254 254 if ( current_theme_supports( 'post-formats' ) && post_type_supports( $post_type, 'post-formats' ) ) 255 add_meta_box( 'formatdiv', _x( 'Format', 'post format' ), 'post_format_meta_box', null, 'side', 'core' );255 add_meta_box( 'formatdiv', _x( 'Format', 'post format' ), 'post_format_meta_box', null, 'side', 'core', array( '__back_compat_meta_box' => true ) ); 256 256 257 257 // all taxonomies … … 268 268 $tax_meta_box_id = $tax_name . 'div'; 269 269 270 add_meta_box( $tax_meta_box_id, $label, $taxonomy->meta_box_cb, null, 'side', 'core', array( 'taxonomy' => $tax_name ) );270 add_meta_box( $tax_meta_box_id, $label, $taxonomy->meta_box_cb, null, 'side', 'core', array( 'taxonomy' => $tax_name, '__back_compat_meta_box' => true ) ); 271 271 } 272 272 273 273 if ( post_type_supports( $post_type, 'page-attributes' ) || count( get_page_templates( $post ) ) > 0 ) { 274 add_meta_box( 'pageparentdiv', $post_type_object->labels->attributes, 'page_attributes_meta_box', null, 'side', 'core' );274 add_meta_box( 'pageparentdiv', $post_type_object->labels->attributes, 'page_attributes_meta_box', null, 'side', 'core', array( '__back_compat_meta_box' => true ) ); 275 275 } 276 276 277 277 if ( $thumbnail_support && current_user_can( 'upload_files' ) ) 278 add_meta_box('postimagediv', esc_html( $post_type_object->labels->featured_image ), 'post_thumbnail_meta_box', null, 'side', 'low' );278 add_meta_box('postimagediv', esc_html( $post_type_object->labels->featured_image ), 'post_thumbnail_meta_box', null, 'side', 'low', array( '__back_compat_meta_box' => true ) ); 279 279 280 280 if ( post_type_supports($post_type, 'excerpt') ) 281 add_meta_box('postexcerpt', __('Excerpt'), 'post_excerpt_meta_box', null, 'normal', 'core' );281 add_meta_box('postexcerpt', __('Excerpt'), 'post_excerpt_meta_box', null, 'normal', 'core', array( '__back_compat_meta_box' => true ) ); 282 282 283 283 if ( post_type_supports($post_type, 'trackbacks') ) 284 add_meta_box('trackbacksdiv', __('Send Trackbacks'), 'post_trackback_meta_box', null, 'normal', 'core' );284 add_meta_box('trackbacksdiv', __('Send Trackbacks'), 'post_trackback_meta_box', null, 'normal', 'core', array( '__back_compat_meta_box' => true ) ); 285 285 286 286 if ( post_type_supports($post_type, 'custom-fields') ) 287 add_meta_box('postcustom', __('Custom Fields'), 'post_custom_meta_box', null, 'normal', 'core' );287 add_meta_box('postcustom', __('Custom Fields'), 'post_custom_meta_box', null, 'normal', 'core', array( '__back_compat_meta_box' => true ) ); 288 288 289 289 /** … … 300 300 // or if comments or pings are open. 301 301 if ( comments_open( $post ) || pings_open( $post ) || post_type_supports( $post_type, 'comments' ) ) { 302 add_meta_box( 'commentstatusdiv', __( 'Discussion' ), 'post_comment_status_meta_box', null, 'normal', 'core' );302 add_meta_box( 'commentstatusdiv', __( 'Discussion' ), 'post_comment_status_meta_box', null, 'normal', 'core', array( '__back_compat_meta_box' => true ) ); 303 303 } 304 304 … … 313 313 // Comments meta box. 314 314 if ( comments_open( $post ) || pings_open( $post ) || $post->comment_count > 0 || post_type_supports( $post_type, 'comments' ) ) { 315 add_meta_box( 'commentsdiv', __( 'Comments' ), 'post_comment_meta_box', null, 'normal', 'core' );315 add_meta_box( 'commentsdiv', __( 'Comments' ), 'post_comment_meta_box', null, 'normal', 'core', array( '__back_compat_meta_box' => true ) ); 316 316 } 317 317 } 318 318 319 319 if ( ! ( 'pending' == get_post_status( $post ) && ! current_user_can( $post_type_object->cap->publish_posts ) ) ) 320 add_meta_box('slugdiv', __('Slug'), 'post_slug_meta_box', null, 'normal', 'core' );320 add_meta_box('slugdiv', __('Slug'), 'post_slug_meta_box', null, 'normal', 'core', array( '__back_compat_meta_box' => true ) ); 321 321 322 322 if ( post_type_supports( $post_type, 'author' ) && current_user_can( $post_type_object->cap->edit_others_posts ) ) { 323 add_meta_box( 'authordiv', __( 'Author' ), 'post_author_meta_box', null, 'normal', 'core' );323 add_meta_box( 'authordiv', __( 'Author' ), 'post_author_meta_box', null, 'normal', 'core', array( '__back_compat_meta_box' => true ) ); 324 324 } 325 325 -
branches/5.0/src/wp-admin/includes/template.php
r43496 r43779 1052 1052 if ( false == $box || ! $box['title'] ) 1053 1053 continue; 1054 1055 // Don't show boxes in the block editor, if they're just here for back compat. 1056 if ( $screen->is_block_editor() && isset( $box['args']['__back_compat_meta_box'] ) && $box['args']['__back_compat_meta_box'] ) { 1057 continue; 1058 } 1059 1060 // Don't show boxes in the block editor that aren't compatible with the block editor. 1061 if ( $screen->is_block_editor() && isset( $box['args']['__block_editor_compatible_meta_box'] ) && ! $box['args']['__block_editor_compatible_meta_box'] ) { 1062 continue; 1063 } 1064 1065 $block_compatible = true; 1066 if ( isset( $box['args']['__block_editor_compatible_meta_box'] ) ) { 1067 $block_compatible = (bool) $box['args']['__block_editor_compatible_meta_box']; 1068 unset( $box['args']['__block_editor_compatible_meta_box'] ); 1069 } 1070 1071 if ( isset( $box['args']['__back_compat_meta_box'] ) ) { 1072 $block_compatible |= (bool) $box['args']['__back_compat_meta_box']; 1073 unset( $box['args']['__back_compat_meta_box'] ); 1074 } 1075 1054 1076 $i++; 1055 1077 $hidden_class = in_array($box['id'], $hidden) ? ' hide-if-js' : ''; … … 1071 1093 echo "<h2 class='hndle'><span>{$box['title']}</span></h2>\n"; 1072 1094 echo '<div class="inside">' . "\n"; 1095 1096 if ( WP_DEBUG && ! $screen->is_block_editor() && ! isset( $_GET['meta-box-loader'] ) ) { 1097 if ( is_array( $box['callback'] ) ) { 1098 $reflection = new ReflectionMethod( $box['callback'][0], $box['callback'][1] ); 1099 } else { 1100 $reflection = new ReflectionFunction( $box['callback'] ); 1101 } 1102 1103 // Don't show an error if it's an internal PHP function. 1104 if ( ! $reflection->isInternal() ) { 1105 1106 // Only show errors if the meta box was registered by a plugin. 1107 $filename = $reflection->getFileName(); 1108 if ( strpos( $filename, WP_PLUGIN_DIR ) === 0 ) { 1109 $filename = str_replace( WP_PLUGIN_DIR, '', $filename ); 1110 $filename = preg_replace( '|^/([^/]*/).*$|', '\\1', $filename ); 1111 1112 $plugins = get_plugins(); 1113 foreach ( $plugins as $name => $plugin ) { 1114 if ( strpos( $name, $filename ) === 0 ) { 1115 ?> 1116 <div class="error inline"> 1117 <p> 1118 <?php 1119 /* translators: %s: the name of the plugin that generated this meta box. */ 1120 printf( __( "This meta box, from the %s plugin, isn't compatible with the block editor." ), "<strong>{$plugin['Name']}</strong>" ); 1121 ?> 1122 </p> 1123 </div> 1124 <?php 1125 } 1126 } 1127 } 1128 } 1129 } 1130 1073 1131 call_user_func($box['callback'], $object, $box); 1074 1132 echo "</div>\n";
Note: See TracChangeset
for help on using the changeset viewer.