@@ -203,13 +203,18 @@ class WP_Theme_JSON_Gutenberg {
203
203
* removed the `--wp--style--block-gap` property.
204
204
* @since 6.2.0 Added `outline-*`, and `min-height` properties.
205
205
* @since 6.3.0 Added `writing-mode` property.
206
+ * @since 6.6.0 Added `background-[image|position|repeat|size]` properties.
206
207
*
207
208
* @var array
208
209
*/
209
210
const PROPERTIES_METADATA = array (
210
211
'aspect-ratio ' => array ( 'dimensions ' , 'aspectRatio ' ),
211
212
'background ' => array ( 'color ' , 'gradient ' ),
212
213
'background-color ' => array ( 'color ' , 'background ' ),
214
+ 'background-image ' => array ( 'background ' , 'backgroundImage ' ),
215
+ 'background-position ' => array ( 'background ' , 'backgroundPosition ' ),
216
+ 'background-repeat ' => array ( 'background ' , 'backgroundRepeat ' ),
217
+ 'background-size ' => array ( 'background ' , 'backgroundSize ' ),
213
218
'border-radius ' => array ( 'border ' , 'radius ' ),
214
219
'border-top-left-radius ' => array ( 'border ' , 'radius ' , 'topLeft ' ),
215
220
'border-top-right-radius ' => array ( 'border ' , 'radius ' , 'topRight ' ),
@@ -461,10 +466,17 @@ class WP_Theme_JSON_Gutenberg {
461
466
* added new property `shadow`,
462
467
* updated `blockGap` to be allowed at any level.
463
468
* @since 6.2.0 Added `outline`, and `minHeight` properties.
469
+ * @since 6.6.0 Added `background` sub properties to top-level only.
464
470
*
465
471
* @var array
466
472
*/
467
473
const VALID_STYLES = array (
474
+ 'background ' => array (
475
+ 'backgroundImage ' => 'top ' ,
476
+ 'backgroundPosition ' => 'top ' ,
477
+ 'backgroundRepeat ' => 'top ' ,
478
+ 'backgroundSize ' => 'top ' ,
479
+ ),
468
480
'border ' => array (
469
481
'color ' => null ,
470
482
'radius ' => null ,
@@ -1334,7 +1346,6 @@ public function get_block_custom_css_nodes() {
1334
1346
return $ block_nodes ;
1335
1347
}
1336
1348
1337
-
1338
1349
/**
1339
1350
* Returns the global styles custom CSS for a single block.
1340
1351
*
@@ -2120,6 +2131,12 @@ protected static function compute_style_properties( $styles, $settings = array()
2120
2131
}
2121
2132
}
2122
2133
2134
+ // Processes background styles.
2135
+ if ( 'background ' === $ value_path [0 ] && isset ( $ styles ['background ' ] ) ) {
2136
+ $ background_styles = gutenberg_get_background_support_styles ( $ styles ['background ' ] );
2137
+ $ value = $ background_styles ['declarations ' ][ $ css_property ] ?? $ value ;
2138
+ }
2139
+
2123
2140
// Skip if empty and not "0" or value represents array of longhand values.
2124
2141
$ has_missing_value = empty ( $ value ) && ! is_numeric ( $ value );
2125
2142
if ( $ has_missing_value || is_array ( $ value ) ) {
0 commit comments