is_block_editor example


function wp_global_styles_render_svg_filters() {
    _deprecated_function( __FUNCTION__, '6.3.0' );

    /* * When calling via the in_admin_header action, we only want to render the * SVGs on block editor pages. */
    if (
        is_admin() &&
        ! get_current_screen()->is_block_editor()
    ) {
        return;
    }

    $filters = wp_get_global_styles_svg_filters();
    if ( ! empty( $filters ) ) {
        echo $filters;
    }
}

/** * Build an array with CSS classes and inline styles defining the colors * which will be applied to the navigation markup in the front-end. * * @since 5.9.0 * @deprecated 6.3.0 This was removed from the Navigation Submenu block in favour of `wp_apply_colors_support()`. * `wp_apply_colors_support()` returns an array with similar class and style values, * but with different keys: `class` and `style`. * * @param array $context Navigation block context. * @param array $attributes Block attributes. * @param bool $is_sub_menu Whether the block is a sub-menu. * @return array Colors CSS classes and inline styles. */
$current_screen = get_current_screen();
        $policy_page_id = (int) get_option( 'wp_page_for_privacy_policy' );

        if ( 'post' !== $current_screen->base || $policy_page_id !== $post->ID ) {
            return;
        }

        $message = __( 'Need help putting together your new Privacy Policy page? Check out our guide for recommendations on what content to include, along with policies suggested by your plugins and theme.' );
        $url     = esc_url( admin_url( 'options-privacy.php?tab=policyguide' ) );
        $label   = __( 'View Privacy Policy Guide.' );

        if ( get_current_screen()->is_block_editor() ) {
            wp_enqueue_script( 'wp-notices' );
            $action = array(
                'url'   => $url,
                'label' => $label,
            );
            wp_add_inline_script(
                'wp-notices',
                sprintf(
                    'wp.data.dispatch( "core/notices" ).createWarningNotice( "%s", { actions: [ %s ], isDismissible: false } )',
                    $message,
                    wp_json_encode( $action )
                ),


/** * @global string $post_type * @global WP_Post_Type $post_type_object * @global WP_Post $post Global post object. */
global $post_type$post_type_object$post;

// Flag that we're not loading the block editor. $current_screen = get_current_screen();
$current_screen->is_block_editor( false );

if ( is_multisite() ) {
    add_action( 'admin_footer', '_admin_notice_post_locked' );
} else {
    $check_users = get_users(
        array(
            'fields' => 'ID',
            'number' => 2,
        )
    );

    
if ( is_multisite() ) {
    $admin_body_class .= ' multisite';
}

if ( is_network_admin() ) {
    $admin_body_class .= ' network-admin';
}

$admin_body_class .= ' no-customize-support no-svg';

if ( $current_screen->is_block_editor() ) {
    $admin_body_class .= ' block-editor-page wp-embed-responsive';
}

$error_get_last = error_get_last();

// Print a CSS class to make PHP errors visible. if ( $error_get_last && WP_DEBUG && WP_DEBUG_DISPLAY && ini_get( 'display_errors' )
    // Don't print the class for PHP notices in wp-config.php, as they happen before WP_DEBUG takes effect,     // and should not be displayed with the `error_reporting` level previously set in wp-load.php.     && ( E_NOTICE !== $error_get_last['type'] || 'wp-config.php' !== wp_basename( $error_get_last['file'] ) )
) {
    

function wp_should_load_block_editor_scripts_and_styles() {
    global $current_screen;

    $is_block_editor_screen = ( $current_screen instanceof WP_Screen ) && $current_screen->is_block_editor();

    /** * Filters the flag that decides whether or not block editor scripts and styles * are going to be enqueued on the current screen. * * @since 5.6.0 * * @param bool $is_block_editor_screen Current value of the flag. */
    return apply_filters( 'should_load_block_editor_scripts_and_styles', $is_block_editor_screen );
}



// Don't load directly. if ( ! defined( 'ABSPATH' ) ) {
    die( '-1' );
}

// Flag that we're loading the block editor. $current_screen = get_current_screen();
$current_screen->is_block_editor( true );

$block_editor_context = new WP_Block_Editor_Context( array( 'name' => 'core/edit-widgets' ) );

$preload_paths = array(
    array( rest_get_route_for_post_type_items( 'attachment' ), 'OPTIONS' ),
    '/wp/v2/widget-types?context=edit&per_page=-1',
    '/wp/v2/sidebars?context=edit&per_page=-1',
    '/wp/v2/widgets?context=edit&per_page=-1&_embed=about',
);
block_editor_rest_api_preload( $preload_paths$block_editor_context );


global $post_type$post_type_object$post$title$wp_meta_boxes;

$block_editor_context = new WP_Block_Editor_Context( array( 'post' => $post ) );

// Flag that we're loading the block editor. $current_screen = get_current_screen();
$current_screen->is_block_editor( true );

// Default to is-fullscreen-mode to avoid jumps in the UI. add_filter(
    'admin_body_class',
    static function( $classes ) {
        return "$classes is-fullscreen-mode";
    }
);

/* * Emoji replacement is disabled for now, until it plays nicely with React. */
if ( ! wp_is_block_theme() && ! $is_template_part_editor ) {
    wp_die( __( 'The theme you are currently using is not compatible with the Site Editor.' ) );
}

// Used in the HTML title tag. $title       = _x( 'Editor', 'site editor title tag' );
$parent_file = 'themes.php';

// Flag that we're loading the block editor. $current_screen = get_current_screen();
$current_screen->is_block_editor( true );

// Default to is-fullscreen-mode to avoid jumps in the UI. add_filter(
    'admin_body_class',
    static function( $classes ) {
        return "$classes is-fullscreen-mode";
    }
);

$indexed_template_types = array();
foreach ( get_default_block_template_types() as $slug => $template_type ) {
    
/** This filter is documented in wp-admin/post.php */
if ( apply_filters( 'replace_editor', false, $post ) !== true ) {
    if ( use_block_editor_for_post( $post ) ) {
        require ABSPATH . 'wp-admin/edit-form-blocks.php';
    } else {
        wp_enqueue_script( 'autosave' );
        require ABSPATH . 'wp-admin/edit-form-advanced.php';
    }
} else {
    // Flag that we're not loading the block editor.     $current_screen = get_current_screen();
    $current_screen->is_block_editor( false );
}

require_once ABSPATH . 'wp-admin/admin-footer.php';

    public function admin_body_classes( $classes ) {
        if ( ! $this->switch_should_render() ) {
            return $classes;
        }

        global $current_screen;
        if ( empty( $current_screen ) ) {
            set_current_screen();
        }

        if ( $current_screen->is_block_editor() ) {
            $should_respect_color_scheme = get_theme_mod( 'respect_user_color_preference', false );
            $background_color            = get_theme_mod( 'background_color', 'D1E4DD' );

            if ( $should_respect_color_scheme && Twenty_Twenty_One_Custom_Colors::get_relative_luminance_from_hex( $background_color ) > 127 ) {
                $classes .= ' twentytwentyone-supports-dark-theme';
            }
        }

        return $classes;
    }

    
if ( isset( $wp_meta_boxes[ $page ][ $context ] ) ) {
        foreach ( array( 'high', 'sorted', 'core', 'default', 'low' ) as $priority ) {
            if ( isset( $wp_meta_boxes[ $page ][ $context ][ $priority ] ) ) {
                foreach ( (array) $wp_meta_boxes[ $page ][ $context ][ $priority ] as $box ) {
                    if ( false === $box || ! $box['title'] ) {
                        continue;
                    }

                    $block_compatible = true;
                    if ( is_array( $box['args'] ) ) {
                        // If a meta box is just here for back compat, don't show it in the block editor.                         if ( $screen->is_block_editor() && isset( $box['args']['__back_compat_meta_box'] ) && $box['args']['__back_compat_meta_box'] ) {
                            continue;
                        }

                        if ( isset( $box['args']['__block_editor_compatible_meta_box'] ) ) {
                            $block_compatible = (bool) $box['args']['__block_editor_compatible_meta_box'];
                            unset( $box['args']['__block_editor_compatible_meta_box'] );
                        }

                        // If the meta box is declared as incompatible with the block editor, override the callback function.                         if ( ! $block_compatible && $screen->is_block_editor() ) {
                            $box['old_callback'] = $box['callback'];
                            
Home | Imprint | This part of the site doesn't use cookies.