WP_Theme_JSON_Resolver::style_variation_has_scope()private staticWP 6.6.0

Determines if a supplied style variation matches the provided scope.

For backwards compatibility, if a variation does not define any scope related property, e.g. blockTypes, it is assumed to be a theme style variation.

Метод класса: WP_Theme_JSON_Resolver{}

Хуков нет.

Возвращает

true|false.

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

$result = WP_Theme_JSON_Resolver::style_variation_has_scope( $variation, $scope );
$variation(массив) (обязательный)
Theme.json shaped style variation object.
$scope(строка) (обязательный)
Scope to check e.g. theme, block etc.

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

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

Код WP_Theme_JSON_Resolver::style_variation_has_scope() WP 6.6.2

private static function style_variation_has_scope( $variation, $scope ) {
	if ( 'block' === $scope ) {
		return isset( $variation['blockTypes'] );
	}

	if ( 'theme' === $scope ) {
		return ! isset( $variation['blockTypes'] );
	}

	return false;
}