WP_Theme_JSON::filter_slugs( array $node, array $slugs ): array

In this article

Removes the preset values whose slug is equal to any of given slugs.

Parameters

$nodearrayrequired
The node with the presets to validate.
$slugsarrayrequired
The slugs that should not be overridden.

Return

array The new node.

Source

public function get_styles_for_block( $block_metadata ) {
	$node                 = _wp_array_get( $this->theme_json, $block_metadata['path'], array() );
	$use_root_padding     = isset( $this->theme_json['settings']['useRootPaddingAwareAlignments'] ) && true === $this->theme_json['settings']['useRootPaddingAwareAlignments'];
	$selector             = $block_metadata['selector'];
	$settings             = isset( $this->theme_json['settings'] ) ? $this->theme_json['settings'] : array();
	$feature_declarations = static::get_feature_declarations_for_node( $block_metadata, $node );
	$is_root_selector     = static::ROOT_BLOCK_SELECTOR === $selector;

	// If there are style variations, generate the declarations for them, including any feature selectors the block may have.
	$style_variation_declarations = array();
	$style_variation_custom_css   = array();
	if ( ! empty( $block_metadata['variations'] ) ) {
		foreach ( $block_metadata['variations'] as $style_variation ) {
			$style_variation_node           = _wp_array_get( $this->theme_json, $style_variation['path'], array() );

Changelog

VersionDescription
5.9.0Introduced.

User Contributed Notes

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