Make WordPress Core

Ticket #46195: 46195.6.diff

File 46195.6.diff, 3.0 KB (added by desrosj, 6 years ago)
  • src/wp-admin/edit-form-advanced.php

     
    1818 */
    1919global $post_type, $post_type_object, $post;
    2020
     21// Flag that we're not loading the block editor.
     22$current_screen = get_current_screen();
     23$current_screen->is_block_editor( false );
     24
    2125if ( is_multisite() ) {
    2226        add_action( 'admin_footer', '_admin_notice_post_locked' );
    2327} else {
  • src/wp-admin/includes/class-wp-screen.php

     
    202202                        return $hook_name;
    203203                }
    204204
    205                 $post_type = $taxonomy = null;
    206                 $in_admin  = false;
    207                 $action    = '';
     205                $post_type       = $taxonomy = null;
     206                $in_admin        = false;
     207                $action          = '';
     208                $is_block_editor = false;
    208209
    209210                if ( $hook_name ) {
    210211                        $id = $hook_name;
     
    294295                                                $post = get_post( $post_id );
    295296                                                if ( $post ) {
    296297                                                        $post_type = $post->post_type;
     298
     299                                                        $replace_editor = apply_filters( 'replace_editor', false, $post );
     300
     301                                                        if ( ! $replace_editor ) {
     302                                                                $is_block_editor = use_block_editor_for_post( $post );
     303                                                        }
    297304                                                }
    298305                                        }
    299306                                        break;
     
    314321                                if ( null === $post_type ) {
    315322                                        $post_type = 'post';
    316323                                }
     324
     325                                // When creating a new post, use the default block editor support value for the post type.
     326                                if ( empty( $post_id ) ) {
     327                                        $is_block_editor = use_block_editor_for_post_type( $post_type );
     328                                }
     329
    317330                                $id = $post_type;
    318331                                break;
    319332                        case 'edit':
     
    357370                        $screen->id = $id;
    358371                }
    359372
    360                 $screen->base       = $base;
    361                 $screen->action     = $action;
    362                 $screen->post_type  = (string) $post_type;
    363                 $screen->taxonomy   = (string) $taxonomy;
    364                 $screen->is_user    = ( 'user' == $in_admin );
    365                 $screen->is_network = ( 'network' == $in_admin );
    366                 $screen->in_admin   = $in_admin;
     373                $screen->base            = $base;
     374                $screen->action          = $action;
     375                $screen->post_type       = (string) $post_type;
     376                $screen->taxonomy        = (string) $taxonomy;
     377                $screen->is_user         = ( 'user' == $in_admin );
     378                $screen->is_network      = ( 'network' == $in_admin );
     379                $screen->in_admin        = $in_admin;
     380                $screen->is_block_editor = $is_block_editor;
    367381
    368382                self::$_registry[ $id ] = $screen;
    369383
  • src/wp-admin/post-new.php

     
    7474                wp_enqueue_script( 'autosave' );
    7575                include( ABSPATH . 'wp-admin/edit-form-advanced.php' );
    7676        }
     77} else {
     78        // Flag that we're not loading the block editor.
     79        $current_screen = get_current_screen();
     80        $current_screen->is_block_editor( false );
    7781}
    7882
    7983include( ABSPATH . 'wp-admin/admin-footer.php' );