Determines if a supplied style variation matches the provided scope.
Description
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.
Parameters
$variation
arrayrequired- Theme.json shaped style variation object.
$scope
stringrequired- Scope to check e.g. theme, block etc.
Source
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;
}
Changelog
Version | Description |
---|---|
6.6.0 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.