WP_Theme_JSON::convert_variables_to_value( array $styles, array $values ): array

In this article

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.

Replaces CSS variables with their values in place.

Parameters

$stylesarrayrequired
CSS declarations to convert.
$valuesarrayrequired
key => value pairs to use for replacement.

Return

array

Source

}

/**
 * Generates all the element selectors for a block.
 *
 * @since 6.3.0
 *
 * @param string $root_selector The block's root CSS selector.
 * @return array The block's element selectors.
 */
protected static function get_block_element_selectors( $root_selector ) {
	/*
	 * Assign defaults, then override those that the block sets by itself.
	 * If the block selector is compounded, will append the element to each
	 * individual block selector.
	 */
	$block_selectors   = explode( ',', $root_selector );
	$element_selectors = array();
	foreach ( static::ELEMENTS as $el_name => $el_selector ) {
		$element_selector = array();
		foreach ( $block_selectors as $selector ) {
			if ( $selector === $el_selector ) {
				$element_selector = array( $el_selector );
				break;
			}
			$element_selector[] = static::prepend_to_selector( $el_selector, $selector . ' ' );
		}
		$element_selectors[ $el_name ] = implode( ',', $element_selector );
	}

	return $element_selectors;
}

/**
 * Generates style declarations for a node's features e.g., color, border,
 * typography etc. that have custom selectors in their related block's
 * metadata.

Changelog

VersionDescription
6.3.0Introduced.

User Contributed Notes

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