Changeset 43885 for branches/5.0/src/wp-admin/edit-form-blocks.php
- Timestamp:
- 11/12/2018 03:37:41 AM (7 years ago)
- File:
-
- 1 edited
-
branches/5.0/src/wp-admin/edit-form-blocks.php (modified) (4 diffs)
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' );
Note: See TracChangeset
for help on using the changeset viewer.