Skip to content

Commit

Permalink
Respect isActive
Browse files Browse the repository at this point in the history
  • Loading branch information
ockham committed May 21, 2024
1 parent c1eb57a commit 3206431
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/wp-includes/blocks.php
Original file line number Diff line number Diff line change
Expand Up @@ -2393,7 +2393,11 @@ function get_canonical_block_name( $block_name ) {
function infer_block_variation( $block_type, $block_attributes ) {
$variations = $block_type->get_variations();
foreach ( $variations as $variation ) {
foreach ( $variation['attributes'] as $attribute => $value ) {
$attributes = $variation['attributes'];
if ( isset( $variation['isActive'] ) && is_array( $variation['isActive'] ) ) {
$attributes = array_intersect_key( $attributes, array_flip( $variation['isActive'] ) );
}
foreach ( $attributes as $attribute => $value ) {
if ( ! isset( $block_attributes[ $attribute ] ) || $block_attributes[ $attribute ] !== $value ) {
continue 2;
}
Expand Down

0 comments on commit 3206431

Please sign in to comment.