Skip to content

Commit

Permalink
Avoid duplicate code.
Browse files Browse the repository at this point in the history
  • Loading branch information
felixarntz authored and ockham committed Oct 12, 2023
1 parent 5932fba commit 5c27373
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions src/wp-includes/class-wp-block-patterns-registry.php
Original file line number Diff line number Diff line change
Expand Up @@ -192,15 +192,8 @@ public function get_registered( $pattern_name ) {
return null;
}

$pattern = $this->registered_patterns[ $pattern_name ];
$hooked_blocks = get_hooked_blocks();

if ( ! empty( $hooked_blocks ) || has_filter( 'hooked_block_types' ) ) {
$blocks = parse_blocks( $pattern['content'] );
$before_block_visitor = make_before_block_visitor( $hooked_blocks, $pattern );
$after_block_visitor = make_after_block_visitor( $hooked_blocks, $pattern );
$pattern['content'] = traverse_and_serialize_blocks( $blocks, $before_block_visitor, $after_block_visitor );
}
$pattern = $this->registered_patterns[ $pattern_name ];
$pattern['content'] = $this->prepare_content( $pattern, get_hooked_blocks() );

return $pattern;
}
Expand Down

0 comments on commit 5c27373

Please sign in to comment.