Make WordPress Core

Ticket #46195: 46195.5.diff

File 46195.5.diff, 2.4 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;
     
    293294                                        if ( $post_id ) {
    294295                                                $post = get_post( $post_id );
    295296                                                if ( $post ) {
    296                                                         $post_type = $post->post_type;
     297                                                        $post_type       = $post->post_type;
     298                                                        $is_block_editor = use_block_editor_for_post( $post );
    297299                                                }
    298300                                        }
    299301                                        break;
     
    314316                                if ( null === $post_type ) {
    315317                                        $post_type = 'post';
    316318                                }
     319
     320                                // When creating a new post, use the default block editor support value for the post type.
     321                                if ( empty( $post_id ) ) {
     322                                        $is_block_editor = use_block_editor_for_post_type( $post_type );
     323                                }
     324
    317325                                $id = $post_type;
    318326                                break;
    319327                        case 'edit':
     
    357365                        $screen->id = $id;
    358366                }
    359367
    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;
     368                $screen->base            = $base;
     369                $screen->action          = $action;
     370                $screen->post_type       = (string) $post_type;
     371                $screen->taxonomy        = (string) $taxonomy;
     372                $screen->is_user         = ( 'user' == $in_admin );
     373                $screen->is_network      = ( 'network' == $in_admin );
     374                $screen->in_admin        = $in_admin;
     375                $screen->is_block_editor = $is_block_editor;
    367376
    368377                self::$_registry[ $id ] = $screen;
    369378