wp-includes/style-engine/class-wp-style-engine.php:464Returns classnames and CSS based on the values in a styles object.
$block_stylesarray$optionsarray$convert_vars_to_classnamesbooldefault: false
$selectorstring
array$declarationsstring[]
public static function parse_block_styles( $block_styles, $options ) { $parsed_styles = array( 'classnames' => array(), 'declarations' => array(), ); if ( empty( $block_styles ) || ! is_array( $block_styles ) ) { return $parsed_styles; } // Collect CSS and classnames. foreach ( static::BLOCK_STYLE_DEFINITIONS_METADATA as $definition_group_key => $definition_group_style ) { if ( empty( $block_styles[ $definition_group_key ] ) ) { continue; } foreach ( $definition_group_style as $style_definition ) { $style_value = _wp_array_get( $block_styles, $style_definition['path'], null ); if ( ! static::is_valid_style_value( $style_value ) ) { continue; } $classnames = static::get_classnames( $style_value, $style_definition ); if ( ! empty( $classnames ) ) { $parsed_styles['classnames'] = array_merge( $parsed_styles['classnames'], $classnames ); } $css_declarations = static::get_css_declarations( $style_value, $style_definition, $options ); if ( ! empty( $css_declarations ) ) { $parsed_styles['declarations'] = array_merge( $parsed_styles['declarations'], $css_declarations ); } } } return $parsed_styles; }Introduced in 6.1.0. Unchanged from 6.7.7 through 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
src/wp-includes/style-engine/class-wp-style-engine.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.