PluginProbe
Gutenberg / trunk
Gutenberg vtrunk
24.1.0 24.0.0 23.9.1 23.9.0 23.8.0 23.7.2 23.7.1 23.7.0 23.6.1 23.6.2 23.6.0 23.5.3 23.5.2 23.5.1 23.5.0 23.4.0 23.3.2 23.3.1 23.3.0 23.2.0 23.2.1 23.2.2 23.1.1 23.1.0 23.0.1 All 404 releases
← All changes | lib/experimental/class-wp-rest-block-editor-settings-controller.php +20 -3 23.2.1 → trunk View file →
@@ -351,10 +351,9 @@
351 351 // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited
352 352 $hook_suffix = 'block-editor-assets';
353 353
354 354 // Remove unwanted scripts/styles.
355 - remove_action( 'admin_enqueue_scripts', 'gutenberg_enqueue_command_palette_assets', 9 );
356 - remove_action( 'admin_enqueue_scripts', 'gutenberg_enqueue_command_palette_assets' );
355 + remove_action( 'admin_enqueue_scripts', 'wp_enqueue_command_palette_assets' );
357 356 remove_action( 'admin_enqueue_scripts', 'wp_auth_check_load' );
358 357 remove_action( 'admin_print_scripts', 'print_emoji_detection_script' );
359 358 remove_action( 'admin_print_styles', 'print_emoji_styles' );
360 359
@@ -399,8 +398,18 @@
399 398 wp_enqueue_style( 'wp-block-library' );
400 399 wp_enqueue_style( 'wp-format-library' );
401 400 wp_enqueue_media();
402 401
402 + /*
403 + * Block style variations provided by the theme's theme.json
404 + * partials are registered lazily, when the theme JSON resolver
405 + * first runs in a request. Nothing has run it in this REST
406 + * request yet, so prime it — otherwise the block styles registry
407 + * is still empty when `enqueue_editor_block_styles_assets()`
408 + * serializes it into the `wp-block-styles` inline script below.
409 + */
410 + WP_Theme_JSON_Resolver_Gutenberg::get_theme_data();
411 +
403 412 do_action( 'enqueue_block_editor_assets' ); // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound
404 413
405 414 // Never allow old admin styles as a dependency.
406 415 wp_deregister_style( 'common' );
@@ -552,9 +561,17 @@
552 561 $script_modules = wp_script_modules();
553 562 $registered = array();
554 563 $reflection = new ReflectionClass( $script_modules );
555 564 $property = $reflection->getProperty( 'registered' );
556 - $property->setAccessible( true );
565 + /*
566 + * ReflectionProperty::setAccessible is:
567 + * - needed until 8.1.0, as property `registered` is private.
568 + * - redundant as of 8.1.0, which made non-public reflection accessible by default.
569 + * - deprecated as of 8.5.0.
570 + */
571 + if ( PHP_VERSION_ID < 80100 ) {
572 + $property->setAccessible( true );
573 + }
557 574 $registered = $property->getValue( $script_modules );
558 575 $import_map = array();
559 576 foreach ( $registered as $id => $module ) {
560 577 // Handle both array and object formats.