Make WordPress Core


Ignore:
Timestamp:
10/31/2023 11:57:35 AM (15 months ago)
Author:
SergeyBiryukov
Message:

Editor: Correctly load RTL stylesheets in register_core_block_style_handles().

When setting an RTL language under Settings → General, some RTL stylesheets were not loaded, with LTR stylesheets being loaded instead, meaning that some blocks were not displayed correctly.

This commit ensures that all appropriate RTL stylesheets are loaded when selecting an RTL language.

Follow-up to [56524].

Reviewed by hellofromTonya.
Merges [57028] to the 6.4 branch.

Props mukesh27, maahrokh, hellofromTonya, joemcgill, huzaifaalmesbah, rajinsharwar, devmuhib, swissspidy.
Fixes #59715.

Location:
branches/6.4
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/6.4

  • branches/6.4/src/wp-includes/blocks/index.php

    r56785 r57031  
    107107        $wp_styles->add_data( $style_handle, 'path', $path );
    108108
    109         $rtl_file = str_replace( "{$suffix}.css", "-rtl{$suffix}.css", $path );
     109        $rtl_file = "{$name}/{$filename}-rtl{$suffix}.css";
    110110        if ( is_rtl() && in_array( $rtl_file, $files, true ) ) {
    111111            $wp_styles->add_data( $style_handle, 'rtl', 'replace' );
    112112            $wp_styles->add_data( $style_handle, 'suffix', $suffix );
    113             $wp_styles->add_data( $style_handle, 'path', $rtl_file );
     113            $wp_styles->add_data( $style_handle, 'path', str_replace( "{$suffix}.css", "-rtl{$suffix}.css", $path ) );
    114114        }
    115115    };
Note: See TracChangeset for help on using the changeset viewer.