Skip to content

Commit

Permalink
Move assignment into if statement
Browse files Browse the repository at this point in the history
  • Loading branch information
talldan committed Sep 19, 2024
1 parent 696a986 commit 3fa50c2
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions src/wp-includes/class-wp-block.php
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,14 @@ private function process_block_bindings() {
: array( 'source' => 'core/pattern-overrides' );
}
$bindings = $updated_bindings;
/*
* Update the bindings metadata of the computed attributes.
* This ensures the block receives the expanded __default binding metadata when it renders.
*/
$computed_attributes['metadata'] = array_merge(
$parsed_block['attrs']['metadata'],
array( 'bindings' => $bindings )
);
}

foreach ( $bindings as $attribute_name => $block_binding ) {
Expand All @@ -311,15 +319,6 @@ private function process_block_bindings() {
}
}

/*
* Update the bindings metadata of the computed attributes.
* This ensures the block receives the expanded __default binding metadata when it renders.
*/
$computed_attributes['metadata'] = array_merge(
$parsed_block['attrs']['metadata'],
array( 'bindings' => $bindings )
);

return $computed_attributes;
}

Expand Down

0 comments on commit 3fa50c2

Please sign in to comment.