Changeset 56064 for trunk/src/wp-includes/blocks/index.php
- Timestamp:
- 06/27/2023 11:26:12 AM (16 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/blocks/index.php
r56044 r56064 56 56 } 57 57 58 $register_style = static function( $name, $filename, $style_handle ) use ( $includes_path, $includes_url, $suffix, $wp_styles, $files ) { 59 $style_path = "blocks/{$name}/{$filename}{$suffix}.css"; 60 $path = $includes_path . $style_path; 61 62 if ( ! in_array( $path, $files, true ) ) { 63 $wp_styles->add( 64 $style_handle, 65 false 66 ); 67 return; 68 } 69 70 $wp_styles->add( $style_handle, $includes_url . $style_path ); 71 $wp_styles->add_data( $style_handle, 'path', $path ); 72 73 $rtl_file = str_replace( "{$suffix}.css", "-rtl{$suffix}.css", $path ); 74 if ( is_rtl() && in_array( $rtl_file, $files, true ) ) { 75 $wp_styles->add_data( $style_handle, 'rtl', 'replace' ); 76 $wp_styles->add_data( $style_handle, 'suffix', $suffix ); 77 $wp_styles->add_data( $style_handle, 'path', $rtl_file ); 78 } 79 }; 80 58 81 foreach ( $core_blocks_meta as $name => $schema ) { 59 82 /** This filter is documented in wp-includes/blocks.php */ … … 68 91 } 69 92 93 // Register block theme styles. 94 $register_style( $name, 'theme', "wp-block-{$name}-theme" ); 95 70 96 foreach ( $style_fields as $style_field => $filename ) { 71 97 $style_handle = $schema[ $style_field ]; … … 73 99 continue; 74 100 } 75 76 $style_path = "blocks/{$name}/{$filename}{$suffix}.css"; 77 $path = $includes_path . $style_path; 78 79 if ( ! in_array( $path, $files, true ) ) { 80 $wp_styles->add( 81 $style_handle, 82 false 83 ); 84 continue; 85 } 86 87 $wp_styles->add( $style_handle, $includes_url . $style_path ); 88 $wp_styles->add_data( $style_handle, 'path', $path ); 89 90 $rtl_file = str_replace( "{$suffix}.css", "-rtl{$suffix}.css", $path ); 91 if ( is_rtl() && in_array( $rtl_file, $files, true ) ) { 92 $wp_styles->add_data( $style_handle, 'rtl', 'replace' ); 93 $wp_styles->add_data( $style_handle, 'suffix', $suffix ); 94 $wp_styles->add_data( $style_handle, 'path', $rtl_file ); 95 } 101 $register_style( $name, $filename, $style_handle ); 96 102 } 97 103 }
Note: See TracChangeset
for help on using the changeset viewer.