Changeset 44244
- Timestamp:
- 12/16/2018 11:23:38 PM (6 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:mergeinfo changed
/branches/5.0 merged: 43885
- Property svn:mergeinfo changed
-
trunk/src/wp-admin/edit-form-blocks.php
r44241 r44244 20 20 * @global string $title 21 21 * @global array $editor_styles 22 */ 23 global $post_type, $post_type_object, $post, $title, $editor_styles; 22 * @global array $wp_meta_boxes 23 */ 24 global $post_type, $post_type_object, $post, $title, $editor_styles, $wp_meta_boxes; 24 25 25 26 if ( ! empty( $post_type_object ) ) { … … 297 298 } 298 299 300 /** 301 * Scripts 302 */ 303 wp_enqueue_media( 304 array( 305 'post' => $post->ID, 306 ) 307 ); 308 wp_enqueue_editor(); 309 310 /** 311 * Styles 312 */ 313 wp_enqueue_style( 'wp-edit-post' ); 314 wp_enqueue_style( 'wp-format-library' ); 315 316 /** 317 * Fires after block assets have been enqueued for the editing interface. 318 * 319 * Call `add_action` on any hook before 'admin_enqueue_scripts'. 320 * 321 * In the function call you supply, simply use `wp_enqueue_script` and 322 * `wp_enqueue_style` to add your functionality to the block editor. 323 * 324 * @since 5.0.0 325 */ 326 do_action( 'enqueue_block_editor_assets' ); 327 328 // In order to duplicate classic meta box behaviour, we need to run the classic meta box actions. 329 require_once( ABSPATH . 'wp-admin/includes/meta-boxes.php' ); 330 register_and_do_post_meta_boxes( $post ); 331 332 // Check if the Custom Fields meta box has been removed at some point. 333 $core_meta_boxes = $wp_meta_boxes[ $current_screen->id ]['normal']['core']; 334 if ( ! isset( $core_meta_boxes['postcustom'] ) || ! $core_meta_boxes['postcustom'] ) { 335 unset( $editor_settings['enableCustomFields'] ); 336 } 337 338 /** 339 * Filters the settings to pass to the block editor. 340 * 341 * @since 5.0.0 342 * 343 * @param array $editor_settings Default editor settings. 344 * @param WP_Post $post Post being edited. 345 */ 346 $editor_settings = apply_filters( 'block_editor_settings', $editor_settings, $post ); 347 299 348 $init_script = <<<JS 300 349 ( function() { … … 307 356 JS; 308 357 309 310 /**311 * Filters the settings to pass to the block editor.312 *313 * @since 5.0.0314 *315 * @param array $editor_settings Default editor settings.316 * @param WP_Post $post Post being edited.317 */318 $editor_settings = apply_filters( 'block_editor_settings', $editor_settings, $post );319 320 358 $script = sprintf( 321 359 $init_script, … … 326 364 ); 327 365 wp_add_inline_script( 'wp-edit-post', $script ); 328 329 /**330 * Scripts331 */332 wp_enqueue_media(333 array(334 'post' => $post->ID,335 )336 );337 wp_enqueue_editor();338 339 /**340 * Styles341 */342 wp_enqueue_style( 'wp-edit-post' );343 wp_enqueue_style( 'wp-format-library' );344 345 /**346 * Fires after block assets have been enqueued for the editing interface.347 *348 * Call `add_action` on any hook before 'admin_enqueue_scripts'.349 *350 * In the function call you supply, simply use `wp_enqueue_script` and351 * `wp_enqueue_style` to add your functionality to the block editor.352 *353 * @since 5.0.0354 */355 do_action( 'enqueue_block_editor_assets' );356 357 // In order to duplicate classic meta box behaviour, we need to run the classic meta box actions.358 require_once( ABSPATH . 'wp-admin/includes/meta-boxes.php' );359 register_and_do_post_meta_boxes( $post );360 366 361 367 require_once( ABSPATH . 'wp-admin/admin-header.php' ); -
trunk/src/wp-admin/includes/meta-boxes.php
r44214 r44244 1464 1464 1465 1465 if ( post_type_supports( $post_type, 'custom-fields' ) ) { 1466 add_meta_box( 'postcustom', __( 'Custom Fields' ), 'post_custom_meta_box', null, 'normal', 'core', array( '__back_compat_meta_box' => true ) ); 1466 $args = array( 1467 '__back_compat_meta_box' => ! (bool) get_user_meta( get_current_user_id(), 'enable_custom_fields', true ), 1468 '__block_editor_compatible_meta_box' => true, 1469 ); 1470 add_meta_box( 'postcustom', __( 'Custom Fields' ), 'post_custom_meta_box', null, 'normal', 'core', $args ); 1467 1471 } 1468 1472 -
trunk/src/wp-admin/includes/template.php
r44178 r44244 1162 1162 1163 1163 $i++; 1164 $hidden_class = in_array( $box['id'], $hidden ) ? ' hide-if-js' : ''; 1164 // get_hidden_meta_boxes() doesn't apply in the block editor. 1165 $hidden_class = ( ! $screen->is_block_editor() && in_array( $box['id'], $hidden ) ) ? ' hide-if-js' : ''; 1165 1166 echo '<div id="' . $box['id'] . '" class="postbox ' . postbox_classes( $box['id'], $page ) . $hidden_class . '" ' . '>' . "\n"; 1166 1167 if ( 'dashboard_browser_nag' != $box['id'] ) {
Note: See TracChangeset
for help on using the changeset viewer.