Changeset 43885
- Timestamp:
- 11/12/2018 03:37:41 AM (6 years ago)
- Location:
- branches/5.0/src/wp-admin
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/5.0/src/wp-admin/edit-form-blocks.php
r43884 r43885 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 ) ) { … … 317 318 } 318 319 320 /** 321 * Scripts 322 */ 323 wp_enqueue_media( 324 array( 325 'post' => $post->ID, 326 ) 327 ); 328 wp_enqueue_editor(); 329 330 /** 331 * Styles 332 */ 333 wp_enqueue_style( 'wp-edit-post' ); 334 wp_enqueue_style( 'wp-format-library' ); 335 336 /** 337 * Fires after block assets have been enqueued for the editing interface. 338 * 339 * Call `add_action` on any hook before 'admin_enqueue_scripts'. 340 * 341 * In the function call you supply, simply use `wp_enqueue_script` and 342 * `wp_enqueue_style` to add your functionality to the block editor. 343 * 344 * @since 5.0.0 345 */ 346 do_action( 'enqueue_block_editor_assets' ); 347 348 // In order to duplicate classic meta box behaviour, we need to run the classic meta box actions. 349 require_once( ABSPATH . 'wp-admin/includes/meta-boxes.php' ); 350 register_and_do_post_meta_boxes( $post ); 351 352 // Check if the Custom Fields meta box has been removed at some point. 353 $core_meta_boxes = $wp_meta_boxes[ $current_screen->id ]['normal']['core']; 354 if ( ! isset( $core_meta_boxes['postcustom'] ) || ! $core_meta_boxes['postcustom'] ) { 355 unset( $editor_settings['enableCustomFields'] ); 356 } 357 358 /** 359 * Filters the settings to pass to the block editor. 360 * 361 * @since 5.0.0 362 * 363 * @param array $editor_settings Default editor settings. 364 * @param WP_Post $post Post being edited. 365 */ 366 $editor_settings = apply_filters( 'block_editor_settings', $editor_settings, $post ); 367 319 368 $init_script = <<<JS 320 369 ( function() { … … 327 376 JS; 328 377 329 330 /**331 * Filters the settings to pass to the block editor.332 *333 * @since 5.0.0334 *335 * @param array $editor_settings Default editor settings.336 * @param WP_Post $post Post being edited.337 */338 $editor_settings = apply_filters( 'block_editor_settings', $editor_settings, $post );339 340 378 $script = sprintf( 341 379 $init_script, … … 346 384 ); 347 385 wp_add_inline_script( 'wp-edit-post', $script ); 348 349 /**350 * Scripts351 */352 wp_enqueue_media(353 array(354 'post' => $post->ID,355 )356 );357 wp_enqueue_editor();358 359 /**360 * Styles361 */362 wp_enqueue_style( 'wp-edit-post' );363 wp_enqueue_style( 'wp-format-library' );364 365 /**366 * Fires after block assets have been enqueued for the editing interface.367 *368 * Call `add_action` on any hook before 'admin_enqueue_scripts'.369 *370 * In the function call you supply, simply use `wp_enqueue_script` and371 * `wp_enqueue_style` to add your functionality to the block editor.372 *373 * @since 5.0.0374 */375 do_action( 'enqueue_block_editor_assets' );376 377 // In order to duplicate classic meta box behaviour, we need to run the classic meta box actions.378 require_once( ABSPATH . 'wp-admin/includes/meta-boxes.php' );379 register_and_do_post_meta_boxes( $post );380 386 381 387 require_once( ABSPATH . 'wp-admin/admin-header.php' ); -
branches/5.0/src/wp-admin/includes/meta-boxes.php
r43863 r43885 1362 1362 1363 1363 if ( post_type_supports($post_type, 'custom-fields') ) { 1364 $screen = get_current_screen(); 1365 if ( ! $screen || ! $screen->is_block_editor() || (bool) get_user_meta( get_current_user_id(), 'enable_custom_fields', true ) ) { 1366 add_meta_box('postcustom', __('Custom Fields'), 'post_custom_meta_box', null, 'normal', 'core', array( '__back_compat_meta_box' => false, '__block_editor_compatible_meta_box' => true ) ); 1367 } 1364 $args = array( 1365 '__back_compat_meta_box' => ! (bool) get_user_meta( get_current_user_id(), 'enable_custom_fields', true ), 1366 '__block_editor_compatible_meta_box' => true 1367 ); 1368 add_meta_box('postcustom', __('Custom Fields'), 'post_custom_meta_box', null, 'normal', 'core', $args ); 1368 1369 } 1369 1370 -
branches/5.0/src/wp-admin/includes/template.php
r43839 r43885 1077 1077 1078 1078 $i++; 1079 $hidden_class = in_array($box['id'], $hidden) ? ' hide-if-js' : ''; 1079 // get_hidden_meta_boxes() doesn't apply in the block editor. 1080 $hidden_class = ( ! $screen->is_block_editor() && in_array( $box['id'], $hidden ) ) ? ' hide-if-js' : ''; 1080 1081 echo '<div id="' . $box['id'] . '" class="postbox ' . postbox_classes($box['id'], $page) . $hidden_class . '" ' . '>' . "\n"; 1081 1082 if ( 'dashboard_browser_nag' != $box['id'] ) {
Note: See TracChangeset
for help on using the changeset viewer.