Make WordPress Core

Changeset 56776

Timestamp:
10/04/2023 06:45:16 PM (10 months ago)
Author:
audrasjb
Message:

Editor: Fix loading of assets in blocks in child themes where the directory name starts with the parent theme's directory name.

Props lgladdy, masteradhoc, audrasjb, rajinsharwar, azaozz.
Merges [56527] to the 6.3 branch.
Fixes #59018.

Location:
branches/6.3
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/6.3

  • branches/6.3/src/wp-includes/blocks.php

    r56244 r56776  
    151151     * the parent (template) or child (stylesheet) directory path.
    152152     */
    153     $is_parent_theme_block = str_starts_with( $script_path_norm, $template_path_norm );
    154     $is_child_theme_block  = str_starts_with( $script_path_norm, $stylesheet_path_norm );
     153    $is_parent_theme_block = str_starts_with( $script_path_norm, );
     154    $is_child_theme_block  = str_starts_with( $script_path_norm, );
    155155    $is_theme_block        = ( $is_parent_theme_block || $is_child_theme_block );
    156156
     
    262262        // Determine if the block style was registered in a theme, by checking if the script path starts with either
    263263        // the parent (template) or child (stylesheet) directory path.
    264         $is_parent_theme_block = str_starts_with( $style_path_norm, $template_path_norm );
    265         $is_child_theme_block  = str_starts_with( $style_path_norm, $stylesheet_path_norm );
     264        $is_parent_theme_block = str_starts_with( $style_path_norm, );
     265        $is_child_theme_block  = str_starts_with( $style_path_norm, );
    266266        $is_theme_block        = ( $is_parent_theme_block || $is_child_theme_block );
    267267
  • branches/6.3/tests/phpunit/tests/blocks/register.php

    r56044 r56776  
    271271
    272272        $this->assertSame( 'unit-tests-test-block-script', $result );
     273
     274
     275
     276
     277
     278
     279
     280
     281
     282
     283
     284
     285
     286
     287
    273288    }
    274289
     
    438453            wp_normalize_path( realpath( DIR_TESTDATA . '/blocks/notice/block.css' ) ),
    439454            wp_normalize_path( wp_styles()->get_data( 'unit-tests-test-block-style', 'path' ) )
     455
     456
     457
     458
     459
     460
     461
     462
     463
     464
     465
     466
     467
     468
     469
    440470        );
    441471    }
Note: See TracChangeset for help on using the changeset viewer.