Changeset 52748
- Timestamp:
- 02/17/2022 01:11:59 PM (3 years ago)
- Location:
- branches/5.9
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/5.9
-
branches/5.9/src/wp-includes/block-supports/elements.php
r52747 r52748 69 69 } 70 70 71 wp_enqueue_block_support ( $style );71 wp_enqueue_block_support_styles( $style ); 72 72 73 73 return $content; -
branches/5.9/src/wp-includes/block-supports/layout.php
r52747 r52748 176 176 ); 177 177 178 wp_enqueue_block_support ( $style );178 wp_enqueue_block_support_styles( $style ); 179 179 180 180 return $content; -
branches/5.9/src/wp-includes/blocks.php
r52747 r52748 1329 1329 } 1330 1330 add_filter( 'block_type_metadata', '_wp_multiple_block_styles' ); 1331 1332 /**1333 * This function takes care of adding inline styles1334 * in the proper place, depending on the theme in use.1335 *1336 * For block themes, it's loaded in the head.1337 * For classic ones, it's loaded in the body1338 * because the wp_head action (and wp_enqueue_scripts)1339 * happens before the render_block.1340 *1341 * See https://core.trac.wordpress.org/ticket/53494.1342 *1343 * @param string $style String containing the CSS styles to be added.1344 */1345 function wp_enqueue_block_support( $style ) {1346 $action_hook_name = 'wp_footer';1347 if ( wp_is_block_theme() ) {1348 $action_hook_name = 'wp_enqueue_scripts';1349 }1350 add_action(1351 $action_hook_name,1352 function () use ( $style ) {1353 echo "<style>$style</style>\n";1354 }1355 );1356 } -
branches/5.9/src/wp-includes/script-loader.php
r52739 r52748 2884 2884 wp_enqueue_style( 'global-styles-css-custom-properties' ); 2885 2885 } 2886 2887 /** 2888 * This function takes care of adding inline styles 2889 * in the proper place, depending on the theme in use. 2890 * 2891 * @since 5.9.1 2892 * 2893 * For block themes, it's loaded in the head. 2894 * For classic ones, it's loaded in the body 2895 * because the wp_head action (and wp_enqueue_scripts) 2896 * happens before the render_block. 2897 * 2898 * @link https://core.trac.wordpress.org/ticket/53494. 2899 * 2900 * @param string $style String containing the CSS styles to be added. 2901 */ 2902 function wp_enqueue_block_support_styles( $style ) { 2903 $action_hook_name = 'wp_footer'; 2904 if ( wp_is_block_theme() ) { 2905 $action_hook_name = 'wp_enqueue_scripts'; 2906 } 2907 add_action( 2908 $action_hook_name, 2909 static function () use ( $style ) { 2910 echo "<style>$style</style>\n"; 2911 } 2912 ); 2913 }
Note: See TracChangeset
for help on using the changeset viewer.