WP_Theme_JSON::get_setting_nodes( array $theme_json, array $selectors = array() ): array

In this article

Builds metadata for the setting nodes, which returns in the form of:

Description

[ [ ‘path’ => [‘path’, ‘to’, ‘some’, ‘node’ ], ‘selector’ => ‘CSS selector for some node’ ], [ ‘path’ => [ ‘path’, ‘to’, ‘other’, ‘node’ ], ‘selector’ => ‘CSS selector for other node’ ], ]

Parameters

$theme_jsonarrayrequired
The tree to extract setting nodes from.
$selectorsarrayoptional
List of selectors per block.

Default:array()

Return

array An array of setting nodes metadata.

Source

}

/*
 * Look up protected properties, keyed by value path.
 * Skip protected properties that are explicitly set to `null`.
 */
if ( is_array( $value_path ) ) {
	$path_string = implode( '.', $value_path );
	if (
		isset( static::PROTECTED_PROPERTIES[ $path_string ] ) &&
		_wp_array_get( $settings, static::PROTECTED_PROPERTIES[ $path_string ], null ) === null
	) {
		continue;
	}
}

// Skip if empty and not "0" or value represents array of longhand values.
$has_missing_value = empty( $value ) && ! is_numeric( $value );
if ( $has_missing_value || is_array( $value ) ) {
	continue;
}

// Calculates fluid typography rules where available.
if ( 'font-size' === $css_property ) {
	/*
	 * wp_get_typography_font_size_value() will check
	 * if fluid typography has been activated and also
	 * whether the incoming value can be converted to a fluid value.
	 * Values that already have a clamp() function will not pass the test,
	 * and therefore the original $value will be returned.
	 */

Changelog

VersionDescription
5.8.0Introduced.

User Contributed Notes

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