Changeset 59980
- Timestamp:
- 03/13/2025 10:58:25 PM (13 months ago)
- Location:
- trunk/src/wp-includes
- Files:
-
- 3 edited
-
default-filters.php (modified) (2 diffs)
-
deprecated.php (modified) (1 diff)
-
script-loader.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/default-filters.php
r59968 r59980 589 589 add_action( 'admin_enqueue_scripts', 'wp_localize_jquery_ui_datepicker', 1000 ); 590 590 add_action( 'admin_enqueue_scripts', 'wp_common_block_scripts_and_styles' ); 591 add_action( 'enqueue_block_assets', 'wp_enqueue_classic_theme_styles' ); 591 592 add_action( 'enqueue_block_assets', 'wp_enqueue_registered_block_scripts_and_styles' ); 592 593 add_action( 'enqueue_block_assets', 'enqueue_block_styles_assets', 30 ); … … 613 614 add_action( 'customize_controls_print_styles', 'wp_resource_hints', 1 ); 614 615 add_action( 'admin_head', 'wp_check_widget_editor_deps' ); 615 add_filter( 'block_editor_settings_all', 'wp_add_editor_classic_theme_styles' );616 616 617 617 // Global styles can be enqueued in both the header and the footer. See https://core.trac.wordpress.org/ticket/53494. -
trunk/src/wp-includes/deprecated.php
r59832 r59980 6423 6423 return current_user_can_for_site( $blog_id, $capability, ...$args ); 6424 6424 } 6425 6426 /** 6427 * Loads classic theme styles on classic themes in the editor. 6428 * 6429 * This is used for backwards compatibility for Button and File blocks specifically. 6430 * 6431 * @since 6.1.0 6432 * @since 6.2.0 Added File block styles. 6433 * @deprecated 6.8.0 Styles are enqueued, not printed in the body element. 6434 * 6435 * @param array $editor_settings The array of editor settings. 6436 * @return array A filtered array of editor settings. 6437 */ 6438 function wp_add_editor_classic_theme_styles( $editor_settings ) { 6439 _deprecated_function( __FUNCTION__, '6.8.0', 'wp_enqueue_classic_theme_styles' ); 6440 6441 if ( wp_theme_has_theme_json() ) { 6442 return $editor_settings; 6443 } 6444 6445 $suffix = wp_scripts_get_suffix(); 6446 $classic_theme_styles = ABSPATH . WPINC . "/css/classic-themes$suffix.css"; 6447 6448 /* 6449 * This follows the pattern of get_block_editor_theme_styles, 6450 * but we can't use get_block_editor_theme_styles directly as it 6451 * only handles external files or theme files. 6452 */ 6453 $classic_theme_styles_settings = array( 6454 'css' => file_get_contents( $classic_theme_styles ), 6455 '__unstableType' => 'core', 6456 'isGlobalStyles' => false, 6457 ); 6458 6459 // Add these settings to the start of the array so that themes can override them. 6460 array_unshift( $editor_settings['styles'], $classic_theme_styles_settings ); 6461 6462 return $editor_settings; 6463 } -
trunk/src/wp-includes/script-loader.php
r59896 r59980 1663 1663 $styles->add_data( 'wp-block-library-theme', 'path', ABSPATH . $block_library_theme_path ); 1664 1664 1665 $classic_theme_styles_path = WPINC . "/css/classic-themes$suffix.css"; 1666 $styles->add( 'classic-theme-styles', "/$classic_theme_styles_path" ); 1667 $styles->add_data( 'classic-theme-styles', 'path', ABSPATH . $classic_theme_styles_path ); 1668 1665 1669 $styles->add( 1666 1670 'wp-reset-editor-styles', … … 3352 3356 * Loads classic theme styles on classic themes in the frontend. 3353 3357 * 3354 * This is needed for backwards compatibility for buttonblocks specifically.3358 * This is used for backwards compatibility for Button and File blocks specifically. 3355 3359 * 3356 3360 * @since 6.1.0 3361 * @since 6.2.0 Added File block styles. 3362 * @since 6.8.0 Moved stylesheet registration outside of this function. 3357 3363 */ 3358 3364 function wp_enqueue_classic_theme_styles() { 3359 3365 if ( ! wp_theme_has_theme_json() ) { 3360 $suffix = wp_scripts_get_suffix();3361 wp_register_style( 'classic-theme-styles', '/' . WPINC . "/css/classic-themes$suffix.css" );3362 wp_style_add_data( 'classic-theme-styles', 'path', ABSPATH . WPINC . "/css/classic-themes$suffix.css" );3363 3366 wp_enqueue_style( 'classic-theme-styles' ); 3364 3367 } 3365 }3366 3367 /**3368 * Loads classic theme styles on classic themes in the editor.3369 *3370 * This is needed for backwards compatibility for button blocks specifically.3371 *3372 * @since 6.1.03373 *3374 * @param array $editor_settings The array of editor settings.3375 * @return array A filtered array of editor settings.3376 */3377 function wp_add_editor_classic_theme_styles( $editor_settings ) {3378 if ( wp_theme_has_theme_json() ) {3379 return $editor_settings;3380 }3381 3382 $suffix = wp_scripts_get_suffix();3383 $classic_theme_styles = ABSPATH . WPINC . "/css/classic-themes$suffix.css";3384 3385 /*3386 * This follows the pattern of get_block_editor_theme_styles,3387 * but we can't use get_block_editor_theme_styles directly as it3388 * only handles external files or theme files.3389 */3390 $classic_theme_styles_settings = array(3391 'css' => file_get_contents( $classic_theme_styles ),3392 '__unstableType' => 'core',3393 'isGlobalStyles' => false,3394 );3395 3396 // Add these settings to the start of the array so that themes can override them.3397 array_unshift( $editor_settings['styles'], $classic_theme_styles_settings );3398 3399 return $editor_settings;3400 3368 } 3401 3369
Note: See TracChangeset
for help on using the changeset viewer.