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.
Method of the class: WP_Theme_JSON_Resolver{}
No Hooks.
Returns
true|false
.
Usage
$result = WP_Theme_JSON_Resolver::style_variation_has_scope( $variation, $scope );
- $variation(array) (required)
- Theme.json shaped style variation object.
- $scope(string) (required)
- Scope to check e.g. theme, block etc.
Changelog
Since 6.6.0 | Introduced. |
WP_Theme_JSON_Resolver::style_variation_has_scope() WP Theme JSON Resolver::style variation has scope code WP 6.8.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; }