WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru
функция не описана

WP_Theme_JSON::get_setting_nodes() private WP 5.8.0

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

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

]

{} Это метод класса: WP_Theme_JSON{}

Хуков нет.

Возвращает

Массив.

Использование

$result = WP_Theme_JSON::get_setting_nodes( $theme_json, $selectors );
$theme_json(массив) (обязательный)
The tree to extract setting nodes from.
$selectors(массив)
List of selectors per block.
По умолчанию: array()

Список изменений

С версии 5.8.0 Введена.

Код WP_Theme_JSON::get_setting_nodes() WP 5.8.1

private static function get_setting_nodes( $theme_json, $selectors = array() ) {
	$nodes = array();
	if ( ! isset( $theme_json['settings'] ) ) {
		return $nodes;
	}

	// Top-level.
	$nodes[] = array(
		'path'     => array( 'settings' ),
		'selector' => self::ROOT_BLOCK_SELECTOR,
	);

	// Calculate paths for blocks.
	if ( ! isset( $theme_json['settings']['blocks'] ) ) {
		return $nodes;
	}

	foreach ( $theme_json['settings']['blocks'] as $name => $node ) {
		$selector = null;
		if ( isset( $selectors[ $name ]['selector'] ) ) {
			$selector = $selectors[ $name ]['selector'];
		}

		$nodes[] = array(
			'path'     => array( 'settings', 'blocks', $name ),
			'selector' => $selector,
		);
	}

	return $nodes;
}