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

foreach ( $block_metadata['variations'] as $style_variation ) {
	$style_variation_node           = _wp_array_get( $this->theme_json, $style_variation['path'], array() );
	$clean_style_variation_selector = trim( $style_variation['selector'] );

	// Generate any feature/subfeature style declarations for the current style variation.
	$variation_declarations = static::get_feature_declarations_for_node( $block_metadata, $style_variation_node );

	// Combine selectors with style variation's selector and add to overall style variation declarations.
	foreach ( $variation_declarations as $current_selector => $new_declarations ) {
		// If current selector includes block classname, remove it but leave the whitespace in.
		$shortened_selector = str_replace( $block_metadata['selector'] . ' ', ' ', $current_selector );

		// Prepend the variation selector to the current selector.
		$split_selectors    = explode( ',', $shortened_selector );

Changelog

VersionDescription
5.9.0Introduced.

User Contributed Notes

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