@@ -243,6 +243,50 @@ function get_block_editor_settings( $editor_name, $custom_settings = array() ) {
243243 $ custom_settings
244244 );
245245
246+ $ editor_settings ['__experimentalFeatures ' ] = WP_Theme_JSON_Resolver::get_merged_data ( $ editor_settings )->get_settings ();
247+
248+ // These settings may need to be updated based on data coming from theme.json sources.
249+ if ( isset ( $ editor_settings ['__experimentalFeatures ' ]['color ' ]['palette ' ] ) ) {
250+ $ editor_settings ['colors ' ] = $ editor_settings ['__experimentalFeatures ' ]['color ' ]['palette ' ];
251+ unset( $ editor_settings ['__experimentalFeatures ' ]['color ' ]['palette ' ] );
252+ }
253+ if ( isset ( $ editor_settings ['__experimentalFeatures ' ]['color ' ]['gradients ' ] ) ) {
254+ $ editor_settings ['gradients ' ] = $ editor_settings ['__experimentalFeatures ' ]['color ' ]['gradients ' ];
255+ unset( $ editor_settings ['__experimentalFeatures ' ]['color ' ]['gradients ' ] );
256+ }
257+ if ( isset ( $ editor_settings ['__experimentalFeatures ' ]['color ' ]['custom ' ] ) ) {
258+ $ editor_settings ['disableCustomColors ' ] = $ editor_settings ['__experimentalFeatures ' ]['color ' ]['custom ' ];
259+ unset( $ editor_settings ['__experimentalFeatures ' ]['color ' ]['custom ' ] );
260+ }
261+ if ( isset ( $ editor_settings ['__experimentalFeatures ' ]['color ' ]['customGradient ' ] ) ) {
262+ $ editor_settings ['disableCustomGradients ' ] = $ editor_settings ['__experimentalFeatures ' ]['color ' ]['customGradient ' ];
263+ unset( $ editor_settings ['__experimentalFeatures ' ]['color ' ]['customGradient ' ] );
264+ }
265+ if ( isset ( $ editor_settings ['__experimentalFeatures ' ]['typography ' ]['fontSizes ' ] ) ) {
266+ $ editor_settings ['fontSizes ' ] = $ editor_settings ['__experimentalFeatures ' ]['typography ' ]['fontSizes ' ];
267+ unset( $ editor_settings ['__experimentalFeatures ' ]['typography ' ]['fontSizes ' ] );
268+ }
269+ if ( isset ( $ editor_settings ['__experimentalFeatures ' ]['typography ' ]['customFontSize ' ] ) ) {
270+ $ editor_settings ['disableCustomFontSizes ' ] = $ editor_settings ['__experimentalFeatures ' ]['typography ' ]['customFontSize ' ];
271+ unset( $ editor_settings ['__experimentalFeatures ' ]['typography ' ]['customFontSize ' ] );
272+ }
273+ if ( isset ( $ editor_settings ['__experimentalFeatures ' ]['typography ' ]['customLineHeight ' ] ) ) {
274+ $ editor_settings ['enableCustomLineHeight ' ] = $ editor_settings ['__experimentalFeatures ' ]['typography ' ]['customLineHeight ' ];
275+ unset( $ editor_settings ['__experimentalFeatures ' ]['typography ' ]['customLineHeight ' ] );
276+ }
277+ if ( isset ( $ editor_settings ['__experimentalFeatures ' ]['spacing ' ]['units ' ] ) ) {
278+ if ( ! is_array ( $ editor_settings ['__experimentalFeatures ' ]['spacing ' ]['units ' ] ) ) {
279+ $ editor_settings ['enableCustomUnits ' ] = false ;
280+ } else {
281+ $ editor_settings ['enableCustomUnits ' ] = count ( $ editor_settings ['__experimentalFeatures ' ]['spacing ' ]['units ' ] ) > 0 ;
282+ }
283+ unset( $ editor_settings ['__experimentalFeatures ' ]['spacing ' ]['units ' ] );
284+ }
285+ if ( isset ( $ editor_settings ['__experimentalFeatures ' ]['spacing ' ]['customPadding ' ] ) ) {
286+ $ editor_settings ['enableCustomSpacing ' ] = $ editor_settings ['__experimentalFeatures ' ]['spacing ' ]['customPadding ' ];
287+ unset( $ editor_settings ['__experimentalFeatures ' ]['spacing ' ]['customPadding ' ] );
288+ }
289+
246290 /**
247291 * Filters the settings to pass to the block editor for all editor type.
248292 *
0 commit comments