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

WP_Theme_JSON::get_merged_preset_by_slug() private WP 5.8.0

Given an array of presets keyed by origin and the value key of the preset, it returns an array where each key is the preset slug and each value the preset value.

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

Хуков нет.

Возвращает

Массив. Array of presets where each key is a slug and each value is the preset value.

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

$result = WP_Theme_JSON::get_merged_preset_by_slug( $preset_per_origin, $value_key );
$preset_per_origin(массив) (обязательный)
Array of presets keyed by origin.
$value_key(строка) (обязательный)
The property of the preset that contains its value.

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

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

Код WP_Theme_JSON::get_merged_preset_by_slug() WP 5.8.1

private static function get_merged_preset_by_slug( $preset_per_origin, $value_key ) {
	$result = array();
	foreach ( self::VALID_ORIGINS as $origin ) {
		if ( ! isset( $preset_per_origin[ $origin ] ) ) {
			continue;
		}
		foreach ( $preset_per_origin[ $origin ] as $preset ) {
			/*
			 * We don't want to use kebabCase here,
			 * see https://github.com/WordPress/gutenberg/issues/32347
			 * However, we need to make sure the generated class or CSS variable
			 * doesn't contain spaces.
			 */
			$result[ preg_replace( '/\s+/', '-', $preset['slug'] ) ] = $preset[ $value_key ];
		}
	}
	return $result;
}