@@ -64,89 +64,10 @@ static function () use ( $style ) {
64
64
);
65
65
}
66
66
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
-
145
67
add_filter (
146
68
'block_editor_settings_all ' ,
147
69
function ( $ settings ) {
148
70
// We must override what core is passing now.
149
- $ settings ['__unstableResolvedAssets ' ] = gutenberg_resolve_assets_override ();
150
71
$ settings ['__unstableIsBlockBasedTheme ' ] = wp_is_block_theme ();
151
72
return $ settings ;
152
73
},
0 commit comments