Skip to content

Commit

Permalink
Blocks: Don't abort registering blocks when a missing block file is f…
Browse files Browse the repository at this point in the history
…ound. (#41122)

* Don't abort registering blocks when a missing block file is found.
* Blocks: Don't return early on a malformed block.json
* Fixes #41121
  • Loading branch information
dd32 authored and chad1008 committed May 19, 2022
1 parent 79e338d commit a7b42e0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/blocks.php
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ function gutenberg_reregister_core_block_types() {
// to replace paths with overrides defined by the plugin.
$metadata = json_decode( file_get_contents( $block_json_file ), true );
if ( ! is_array( $metadata ) || ! $metadata['name'] ) {
return false;
continue;
}

if ( $registry->is_registered( $metadata['name'] ) ) {
Expand All @@ -156,7 +156,7 @@ function gutenberg_reregister_core_block_types() {

foreach ( $block_names as $file => $sub_block_names ) {
if ( ! file_exists( $blocks_dir . $file ) ) {
return;
continue;
}

$sub_block_names_normalized = is_string( $sub_block_names ) ? array( $sub_block_names ) : $sub_block_names;
Expand Down

0 comments on commit a7b42e0

Please sign in to comment.