Themes: Better names for WP_Theme::is_block_theme() and wp_is_block_theme() and make wp_is_block_theme() a wrapper.

This commit renames the following method and function to better represent block theme terminology:

* `WP_Theme::is_block_based()` to `WP_Theme::is_block_theme()`
* `wp_is_block_template_theme()` to `wp_is_block_theme()`

It also changes `wp_is_block_theme()` to be a helper wrapper (sugar syntax) for `wp_get_theme()->is_block_theme();`. Why? To ensure both the method and function behave the same, to help Gutenberg maintain WordPress cross-version compatibility, and to make it less cumbersome to port changes from Gutenberg to Core.

Follow-up to [52069], [52247], [52279].

Props antonvlasenko, costdev, hellofromTonya, noisysocks.
Fixes #54550.

git-svn-id: https://develop.svn.wordpress.org/trunk@52330 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Tonya Mork
2021-12-07 00:00:45 +00:00
parent f322c1ef3f
commit 9cc20468ef
10 changed files with 27 additions and 34 deletions

View File

@@ -704,11 +704,11 @@ function wp_prepare_themes_for_js( $themes = null ) {
$can_edit_theme_options = current_user_can( 'edit_theme_options' );
$can_customize = current_user_can( 'customize' );
$is_block_based_theme = $theme->is_block_based();
$is_block_theme = $theme->is_block_theme();
if ( $is_block_based_theme && $can_edit_theme_options ) {
if ( $is_block_theme && $can_edit_theme_options ) {
$customize_action = esc_url( admin_url( 'site-editor.php' ) );
} elseif ( ! $is_block_based_theme && $can_customize && $can_edit_theme_options ) {
} elseif ( ! $is_block_theme && $can_customize && $can_edit_theme_options ) {
$customize_action = esc_url(
add_query_arg(
array(