Skip to content

Commit c3ce573

Browse files
authored
Remove legacy logic for __unstableResolvedAssets (#51100)
1 parent 658847e commit c3ce573

File tree

2 files changed

+1
-81
lines changed

2 files changed

+1
-81
lines changed

lib/compat/wordpress-6.2/script-loader.php

-79
Original file line numberDiff line numberDiff line change
@@ -64,89 +64,10 @@ static function () use ( $style ) {
6464
);
6565
}
6666

67-
/**
68-
* Sets the content assets for the block editor.
69-
*
70-
* Note for core merge: see inline comment on what's been updated.
71-
*/
72-
function gutenberg_resolve_assets_override() {
73-
global $pagenow;
74-
75-
$script_handles = array(
76-
'wp-polyfill',
77-
);
78-
// Note for core merge: only 'wp-edit-blocks' should be in this array.
79-
$style_handles = array(
80-
'wp-edit-blocks',
81-
);
82-
83-
if ( current_theme_supports( 'wp-block-styles' ) ) {
84-
$style_handles[] = 'wp-block-library-theme';
85-
}
86-
87-
if ( 'widgets.php' === $pagenow || 'customize.php' === $pagenow ) {
88-
$style_handles[] = 'wp-widgets';
89-
$style_handles[] = 'wp-edit-widgets';
90-
}
91-
92-
$block_registry = WP_Block_Type_Registry::get_instance();
93-
94-
foreach ( $block_registry->get_all_registered() as $block_type ) {
95-
// In older WordPress versions, like 6.0, these properties are not defined.
96-
if ( isset( $block_type->style_handles ) && is_array( $block_type->style_handles ) ) {
97-
$style_handles = array_merge( $style_handles, $block_type->style_handles );
98-
}
99-
100-
if ( isset( $block_type->editor_style_handles ) && is_array( $block_type->editor_style_handles ) ) {
101-
$style_handles = array_merge( $style_handles, $block_type->editor_style_handles );
102-
}
103-
104-
if ( isset( $block_type->script_handles ) && is_array( $block_type->script_handles ) ) {
105-
$script_handles = array_merge( $script_handles, $block_type->script_handles );
106-
}
107-
}
108-
109-
$style_handles = array_unique( $style_handles );
110-
$done = wp_styles()->done;
111-
112-
ob_start();
113-
114-
// We do not need reset styles for the iframed editor.
115-
wp_styles()->done = array( 'wp-reset-editor-styles' );
116-
wp_styles()->do_items( $style_handles );
117-
wp_styles()->done = $done;
118-
119-
$styles = ob_get_clean();
120-
121-
$script_handles = array_unique( $script_handles );
122-
$done = wp_scripts()->done;
123-
124-
ob_start();
125-
126-
wp_scripts()->done = array();
127-
wp_scripts()->do_items( $script_handles );
128-
wp_scripts()->done = $done;
129-
130-
$scripts = ob_get_clean();
131-
132-
// Generate font @font-face styles.
133-
if ( function_exists( 'wp_print_fonts' ) ) {
134-
ob_start();
135-
wp_print_fonts( true );
136-
$styles .= ob_get_clean();
137-
}
138-
139-
return array(
140-
'styles' => $styles,
141-
'scripts' => $scripts,
142-
);
143-
}
144-
14567
add_filter(
14668
'block_editor_settings_all',
14769
function( $settings ) {
14870
// We must override what core is passing now.
149-
$settings['__unstableResolvedAssets'] = gutenberg_resolve_assets_override();
15071
$settings['__unstableIsBlockBasedTheme'] = wp_is_block_theme();
15172
return $settings;
15273
},

lib/compat/wordpress-6.3/script-loader.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,5 @@ function( $settings ) {
8080
// We must override what core is passing now.
8181
$settings['__unstableResolvedAssets'] = _gutenberg_get_iframed_editor_assets();
8282
return $settings;
83-
},
84-
100
83+
}
8584
);

0 commit comments

Comments
 (0)