Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Also apply to get_all_registered (needed for REST API)
  • Loading branch information
ockham committed Sep 11, 2023
commit b1a82fe1177a4a8bf253db2aa42250b5f7025536
10 changes: 9 additions & 1 deletion src/wp-includes/class-wp-block-patterns-registry.php
Original file line number Diff line number Diff line change
Expand Up @@ -182,11 +182,19 @@ 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'] );
$visitor = _parsed_block_visitor( $pattern ); // TODO: Should we use different functions for template vs pattern?
$patterns[ $index ]['content'] = serialize_blocks( $blocks, $visitor );
}
Comment on lines +192 to +195
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO: Reuse logic from get_registered.


return $patterns;
}

/**
Expand Down