Given the block settings, extracts the CSS Custom Properties for the presets and adds them to the $declarations array following the format:
array( ‘name’ => ‘property_name’, ‘value’ => ‘property_value, )
$settingsarrayrequired
$originsstring[]required
// Skip outputting base styles for flow and constrained layout types if theme doesn't support theme.json. The 'base-layout-styles' type flags this.
if ( in_array( 'base-layout-styles', $types, true ) && ( 'default' === $layout_definition['name'] || 'constrained' === $layout_definition['name'] ) ) {
continue;
}
if (
isset( $base_style_rule['selector'] ) &&
preg_match( $layout_selector_pattern, $base_style_rule['selector'] ) &&
! empty( $base_style_rule['rules'] )
) {
foreach ( $base_style_rule['rules'] as $css_property => $css_value ) {
// Skip rules that reference content size or wide size if they are not defined in the theme.json.
if (
is_string( $css_value ) &&
© 2003–2024 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wp_theme_json/compute_preset_vars