Skip to content

Commit

Permalink
Inject hooked blocks into WP_Block_Patterns_Registry::get_all_registe…
Browse files Browse the repository at this point in the history
…red()
  • Loading branch information
ockham committed Sep 20, 2023
1 parent 06f0345 commit 70b85fe
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/wp-includes/class-wp-block-patterns-registry.php
Original file line number Diff line number Diff line change
Expand Up @@ -184,11 +184,18 @@ public function get_registered( $pattern_name ) {
* and per style.
*/
public function get_all_registered( $outside_init_only = false ) {
return array_values(
$patterns = array_values(
$outside_init_only
? $this->registered_patterns_outside_init
: $this->registered_patterns
);

foreach ( $patterns as $index => $pattern ) {
$blocks = parse_blocks( $pattern['content'] );
$before_block_visitor = make_before_block_visitor( $pattern );
$after_block_visitor = make_after_block_visitor( $pattern );
$patterns[ $index ]['content'] = traverse_and_serialize_blocks( $blocks, $before_block_visitor, $after_block_visitor );
}
}

/**
Expand Down

0 comments on commit 70b85fe

Please sign in to comment.