Alert: This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.
WP_Theme_JSON::get_block_styles( array $style_nodes, array $setting_nodes ): string
Converts each style section into a list of rulesets containing the block styles to be appended to the stylesheet.
Description
See glossary at https://developer.mozilla.org/en-US/docs/Web/CSS/Syntax
For each section this creates a new ruleset such as:
block-selector { style-property-one: value; }
Additionally, it’ll also create new rulesets as classes for each preset value such as:
.has-value-color {
color: value;
}
.has-value-background-color {
background-color: value;
}
.has-value-font-size {
font-size: value;
}
.has-value-gradient-background {
background: value;
}
p.has-value-gradient-background {
background: value;
}
Parameters
-
$style_nodes
array Required -
Nodes with styles.
-
$setting_nodes
array Required -
Nodes with settings.
Return
string The new stylesheet.
Source
File: wp-includes/class-wp-theme-json.php
.
View all references
/**
* Enables some settings.
*
* @since 5.9.0
*
* @param array $context The context to which the settings belong.
*/
protected static function do_opt_in_into_settings( &$context ) {
foreach ( static::APPEARANCE_TOOLS_OPT_INS as $path ) {
// Use "unset prop" as a marker instead of "null" because
// "null" can be a valid value for some props (e.g. blockGap).
if ( 'unset prop' === _wp_array_get( $context, $path, 'unset prop' ) ) {
_wp_array_set( $context, $path, true );
}
}
unset( $context['appearanceTools'] );
}
/**
* Sanitizes the input according to the schemas.
*
* @since 5.8.0
* @since 5.9.0 Added the `$valid_block_names` and `$valid_element_name` parameters.
*
* @param array $input Structure to sanitize.
Changelog
Version | Description |
---|---|
5.8.0 | Introduced. |