Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add gutenberg_get_remote_theme_patterns function #49307

Merged
merged 2 commits into from
Mar 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion lib/compat/wordpress-6.2/block-patterns.php
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@ function gutenberg_register_remote_theme_patterns() {
return;
}

$pattern_settings = WP_Theme_JSON_Resolver_Gutenberg::get_theme_data()->get_patterns();
$pattern_settings = gutenberg_get_remote_theme_patterns();
if ( empty( $pattern_settings ) ) {
return;
}
Expand Down
12 changes: 12 additions & 0 deletions lib/compat/wordpress-6.3/get-global-styles-and-settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -186,3 +186,15 @@ function wp_get_block_css_selector( $block_type, $target = 'root', $fallback = f
return null;
}
}

/**
* Returns the current theme's wanted patterns(slugs) to be
* registered from Pattern Directory.
*
* @since 6.3.0
*
* @return string[]
*/
function gutenberg_get_remote_theme_patterns() {
return WP_Theme_JSON_Resolver_Gutenberg::get_theme_data( array(), array( 'with_supports' => false ) )->get_patterns();
}