Make WordPress Core

Changeset 50919


Ignore:
Timestamp:
05/17/2021 02:26:53 PM (3 years ago)
Author:
gziolo
Message:

Editor: Rename should_load_separate_core_block_assets for consistency

Changes introduced:

  • The wp_should_load_separate_core_block_assets function.
  • The should_load_separate_core_block_assets filter.

Props hellofromTonya, SergeyBiryukov.
Fixes #50328.

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/blocks.php

    r50837 r50919  
    159159    }
    160160    $is_core_block = isset( $metadata['file'] ) && 0 === strpos( $metadata['file'], ABSPATH . WPINC );
    161     if ( $is_core_block && ! should_load_separate_core_block_assets() ) {
     161    if ( $is_core_block && ! wp_should_load_separate_core_block_assets() ) {
    162162        return false;
    163163    }
  • trunk/src/wp-includes/script-loader.php

    r50838 r50919  
    15731573        $path   = "/wp-includes/css/dist/$package/style$suffix.css";
    15741574
    1575         if ( 'block-library' === $package && should_load_separate_core_block_assets() ) {
     1575        if ( 'block-library' === $package && wp_should_load_separate_core_block_assets() ) {
    15761576            $path = "/wp-includes/css/dist/$package/common$suffix.css";
    15771577        }
     
    22792279 * @return bool Whether separate assets will be loaded or not.
    22802280 */
    2281 function should_load_separate_core_block_assets() {
     2281function wp_should_load_separate_core_block_assets() {
    22822282    if ( is_admin() || is_feed() || ( defined( 'REST_REQUEST' ) && REST_REQUEST ) ) {
    22832283        return false;
     
    22932293     *                                   Default false.
    22942294     */
    2295     return apply_filters( 'separate_core_block_assets', false );
     2295    return apply_filters( 'should_load_separate_core_block_assets', false );
    22962296}
    22972297
     
    23072307    global $current_screen;
    23082308
    2309     if ( should_load_separate_core_block_assets() ) {
     2309    if ( wp_should_load_separate_core_block_assets() ) {
    23102310        return;
    23112311    }
  • trunk/tests/phpunit/tests/dependencies/styles.php

    r50838 r50919  
    430430     */
    431431    function test_block_styles_for_viewing_without_split_styles() {
    432         add_filter( 'separate_core_block_assets', '__return_false' );
     432        add_filter( 'should_load_separate_core_block_assets', '__return_false' );
    433433        wp_default_styles( $GLOBALS['wp_styles'] );
    434434
     
    447447     */
    448448    function test_block_styles_for_viewing_with_split_styles() {
    449         add_filter( 'separate_core_block_assets', '__return_true' );
     449        add_filter( 'should_load_separate_core_block_assets', '__return_true' );
    450450        wp_default_styles( $GLOBALS['wp_styles'] );
    451451
Note: See TracChangeset for help on using the changeset viewer.