WP_Theme_JSON_Resolver::style_variation_has_scope
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{}
Хуков нет.
Возвращает
bool. Whether the supplied style variation matches the provided scope.
Использование
$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 Theme JSON Resolver::style variation has scope WP 7.1
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;
}