WP_Theme_JSON::get_block_styles( array $style_nodes, array $setting_nodes ): string

In this article

This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only by core. It is listed here for completeness.

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_nodesarrayrequired
Nodes with styles.
$setting_nodesarrayrequired
Nodes with settings.

Return

string The new stylesheet.

Source

 *              added new properties for `border`, `filter`, `spacing`,
 *              and `typography`.
 * @since 6.1.0 Added new side properties for `border`,
 *              added new property `shadow`,
 *              updated `blockGap` to be allowed at any level.
 * @since 6.2.0 Added `outline`, and `minHeight` properties.
 * @since 6.3.0 Added support for `typography.textColumns`.
 * @since 6.5.0 Added support for `dimensions.aspectRatio`.
 * @since 6.6.0 Added `background` sub properties to top-level only.
 * @since 7.0.0 Added support for `dimensions.width` and `dimensions.height`.
 * @since 7.1.0 Added support for `background.gradient`,`dimensions.minWidth`,
 *              and `typography.textShadow`.
 * @var array
 */
const VALID_STYLES = array(
	'background' => array(
		'backgroundImage'      => null,
		'backgroundPosition'   => null,
		'backgroundRepeat'     => null,
		'backgroundSize'       => null,
		'backgroundAttachment' => null,
		'gradient'             => null,
	),
	'border'     => array(
		'color'  => null,
		'radius' => null,

Changelog

VersionDescription
5.8.0Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.