Editor: Fix regression introduced with loading separate block assets

Related to [50836]. load-styles.php doesn't load the should_load_separate_core_block_assets function and that causes an error 500 - which in turn makes the dashboard appear unstyled.

Props aristath.
Fixes #53180.



Built from https://develop.svn.wordpress.org/trunk@50837


git-svn-id: http://core.svn.wordpress.org/trunk@50446 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
gziolo 2021-05-11 14:16:01 +00:00
parent 8df663cbfa
commit 7f804f8436
3 changed files with 26 additions and 27 deletions

View File

@ -952,26 +952,3 @@ function block_has_support( $block_type, $feature, $default = false ) {
return true === $block_support || is_array( $block_support );
}
/**
* Checks whether separate assets should be loaded for core blocks.
*
* @since 5.8
*
* @return bool
*/
function should_load_separate_core_block_assets() {
if ( is_admin() || is_feed() || ( defined( 'REST_REQUEST' ) && REST_REQUEST ) ) {
return false;
}
/**
* Determine if separate styles & scripts will be loaded for blocks on-render or not.
*
* @since 5.8.0
*
* @param bool $load_separate_styles Whether separate styles will be loaded or not.
*
* @return bool Whether separate styles will be loaded or not.
*/
return apply_filters( 'separate_core_block_assets', false );
}

View File

@ -1364,6 +1364,29 @@ function wp_default_scripts( $scripts ) {
}
}
/**
* Checks whether separate assets should be loaded for core blocks.
*
* @since 5.8
*
* @return bool
*/
function should_load_separate_core_block_assets() {
if ( is_admin() || is_feed() || ( defined( 'REST_REQUEST' ) && REST_REQUEST ) ) {
return false;
}
/**
* Determine if separate styles & scripts will be loaded for blocks on-render or not.
*
* @since 5.8.0
*
* @param bool $load_separate_styles Whether separate styles will be loaded or not.
*
* @return bool Whether separate styles will be loaded or not.
*/
return apply_filters( 'separate_core_block_assets', false );
}
/**
* Assign default styles to $styles object.
*
@ -1501,9 +1524,8 @@ function wp_default_styles( $styles ) {
$fonts_url = 'https://fonts.googleapis.com/css?family=' . urlencode( $font_family );
}
$styles->add( 'wp-editor-font', $fonts_url ); // No longer used in core as of 5.7.
$block_library_theme_path = "/wp-includes/css/dist/block-library/theme$suffix.css";
$styles->add( 'wp-block-library-theme', $block_library_theme_path );
$block_library_theme_path = WPINC . "/css/dist/block-library/theme$suffix.css";
$styles->add( 'wp-block-library-theme', "/$block_library_theme_path" );
$styles->add_data( 'wp-block-library-theme', 'path', ABSPATH . $block_library_theme_path );
$styles->add(

View File

@ -13,7 +13,7 @@
*
* @global string $wp_version
*/
$wp_version = '5.8-alpha-50836';
$wp_version = '5.8-alpha-50837';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.