<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[52330] trunk: Themes: Better names for `WP_Theme::is_block_theme()` and `wp_is_block_theme()` and make `wp_is_block_theme()` a wrapper.</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { white-space: pre-line; overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta" style="font-size: 105%">
<dt style="float: left; width: 6em; font-weight: bold">Revision</dt> <dd><a style="font-weight: bold" href="https://core.trac.wordpress.org/changeset/52330">52330</a><script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","description":"Review this Commit","action":{"@type":"ViewAction","url":"https://core.trac.wordpress.org/changeset/52330","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>hellofromTonya</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2021-12-07 00:00:45 +0000 (Tue, 07 Dec 2021)</dd>
</dl>
<pre style='padding-left: 1em; margin: 2em 0; border-left: 2px solid #ccc; line-height: 1.25; font-size: 105%; font-family: sans-serif'>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 <a href="https://core.trac.wordpress.org/changeset/52069">[52069]</a>, <a href="https://core.trac.wordpress.org/changeset/52247">[52247]</a>, <a href="https://core.trac.wordpress.org/changeset/52279">[52279]</a>.
Props antonvlasenko, costdev, hellofromTonya, noisysocks.
Fixes <a href="https://core.trac.wordpress.org/ticket/54550">#54550</a>.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunksrcwpadminincludesdashboardphp">trunk/src/wp-admin/includes/dashboard.php</a></li>
<li><a href="#trunksrcwpadminincludesthemephp">trunk/src/wp-admin/includes/theme.php</a></li>
<li><a href="#trunksrcwpadminmenuphp">trunk/src/wp-admin/menu.php</a></li>
<li><a href="#trunksrcwpadminsiteeditorphp">trunk/src/wp-admin/site-editor.php</a></li>
<li><a href="#trunksrcwpadminthemeeditorphp">trunk/src/wp-admin/theme-editor.php</a></li>
<li><a href="#trunksrcwpincludesadminbarphp">trunk/src/wp-includes/admin-bar.php</a></li>
<li><a href="#trunksrcwpincludesclasswpthemephp">trunk/src/wp-includes/class-wp-theme.php</a></li>
<li><a href="#trunksrcwpincludespostphp">trunk/src/wp-includes/post.php</a></li>
<li><a href="#trunksrcwpincludesthemephp">trunk/src/wp-includes/theme.php</a></li>
<li><a href="#trunktestsphpunitteststhemewpThemephp">trunk/tests/phpunit/tests/theme/wpTheme.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunksrcwpadminincludesdashboardphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-admin/includes/dashboard.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-admin/includes/dashboard.php 2021-12-06 22:40:45 UTC (rev 52329)
+++ trunk/src/wp-admin/includes/dashboard.php 2021-12-07 00:00:45 UTC (rev 52330)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1993,11 +1993,11 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $customize_url = null;
</span><span class="cx" style="display: block; padding: 0 10px"> $can_edit_theme_options = current_user_can( 'edit_theme_options' );
</span><span class="cx" style="display: block; padding: 0 10px"> $can_customize = current_user_can( 'customize' );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $is_block_based_theme = wp_is_block_template_theme();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $is_block_theme = wp_is_block_theme();
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( $is_block_based_theme && $can_edit_theme_options ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( $is_block_theme && $can_edit_theme_options ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> $customize_url = esc_url( admin_url( 'site-editor.php' ) );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- } elseif ( ! $is_block_based_theme && $can_customize ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ } elseif ( ! $is_block_theme && $can_customize ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> $customize_url = wp_customize_url();
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> ?>
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2012,7 +2012,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> <?php endif; ?>
</span><span class="cx" style="display: block; padding: 0 10px"> <a class="button button-primary button-hero hide-if-customize" href="<?php echo esc_url( admin_url( 'themes.php' ) ); ?>"><?php _e( 'Customize Your Site' ); ?></a>
</span><span class="cx" style="display: block; padding: 0 10px"> <?php if ( current_user_can( 'install_themes' ) || ( current_user_can( 'switch_themes' ) && count( wp_get_themes( array( 'allowed' => true ) ) ) > 1 ) ) : ?>
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- <?php $themes_link = $can_customize && ! $is_block_based_theme ? add_query_arg( 'autofocus[panel]', 'themes', admin_url( 'customize.php' ) ) : admin_url( 'themes.php' ); ?>
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ <?php $themes_link = $can_customize && ! $is_block_theme ? add_query_arg( 'autofocus[panel]', 'themes', admin_url( 'customize.php' ) ) : admin_url( 'themes.php' ); ?>
</ins><span class="cx" style="display: block; padding: 0 10px"> <p class="hide-if-no-customize">
</span><span class="cx" style="display: block; padding: 0 10px"> <?php
</span><span class="cx" style="display: block; padding: 0 10px"> /* translators: %s: URL to Themes panel in Customizer or Themes screen. */
</span></span></pre></div>
<a id="trunksrcwpadminincludesthemephp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-admin/includes/theme.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-admin/includes/theme.php 2021-12-06 22:40:45 UTC (rev 52329)
+++ trunk/src/wp-admin/includes/theme.php 2021-12-07 00:00:45 UTC (rev 52330)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -704,11 +704,11 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $can_edit_theme_options = current_user_can( 'edit_theme_options' );
</span><span class="cx" style="display: block; padding: 0 10px"> $can_customize = current_user_can( 'customize' );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $is_block_based_theme = $theme->is_block_based();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $is_block_theme = $theme->is_block_theme();
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( $is_block_based_theme && $can_edit_theme_options ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( $is_block_theme && $can_edit_theme_options ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> $customize_action = esc_url( admin_url( 'site-editor.php' ) );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- } elseif ( ! $is_block_based_theme && $can_customize && $can_edit_theme_options ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ } elseif ( ! $is_block_theme && $can_customize && $can_edit_theme_options ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> $customize_action = esc_url(
</span><span class="cx" style="display: block; padding: 0 10px"> add_query_arg(
</span><span class="cx" style="display: block; padding: 0 10px"> array(
</span></span></pre></div>
<a id="trunksrcwpadminmenuphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-admin/menu.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-admin/menu.php 2021-12-06 22:40:45 UTC (rev 52329)
+++ trunk/src/wp-admin/menu.php 2021-12-07 00:00:45 UTC (rev 52330)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -202,7 +202,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> /* translators: %s: Number of available theme updates. */
</span><span class="cx" style="display: block; padding: 0 10px"> $submenu['themes.php'][5] = array( sprintf( __( 'Themes %s' ), $count ), $appearance_cap, 'themes.php' );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-if ( wp_is_block_template_theme() ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+if ( wp_is_block_theme() ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> $submenu['themes.php'][6] = array(
</span><span class="cx" style="display: block; padding: 0 10px"> sprintf(
</span><span class="cx" style="display: block; padding: 0 10px"> /* translators: %s: "beta" label */
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -216,9 +216,9 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // Hide Customize link on block themes unless a plugin or theme is using
</span><span class="cx" style="display: block; padding: 0 10px"> // customize_register to add a setting.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-if ( ! wp_is_block_template_theme() || has_action( 'customize_register' ) ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+if ( ! wp_is_block_theme() || has_action( 'customize_register' ) ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> $customize_url = add_query_arg( 'return', urlencode( remove_query_arg( wp_removable_query_args(), wp_unslash( $_SERVER['REQUEST_URI'] ) ) ), 'customize.php' );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $position = wp_is_block_template_theme() ? 7 : 6;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $position = wp_is_block_theme() ? 7 : 6;
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $submenu['themes.php'][ $position ] = array( __( 'Customize' ), 'customize', esc_url( $customize_url ), '', 'hide-if-no-customize' );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -255,7 +255,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> function _add_themes_utility_last() {
</span><span class="cx" style="display: block; padding: 0 10px"> add_submenu_page(
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- wp_is_block_template_theme() ? 'tools.php' : 'themes.php',
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ wp_is_block_theme() ? 'tools.php' : 'themes.php',
</ins><span class="cx" style="display: block; padding: 0 10px"> __( 'Theme Editor' ),
</span><span class="cx" style="display: block; padding: 0 10px"> __( 'Theme Editor' ),
</span><span class="cx" style="display: block; padding: 0 10px"> 'edit_themes',
</span></span></pre></div>
<a id="trunksrcwpadminsiteeditorphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-admin/site-editor.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-admin/site-editor.php 2021-12-06 22:40:45 UTC (rev 52329)
+++ trunk/src/wp-admin/site-editor.php 2021-12-07 00:00:45 UTC (rev 52330)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -19,7 +19,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-if ( ! wp_is_block_template_theme() ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+if ( ! wp_is_block_theme() ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> wp_die( __( 'The theme you are currently using is not compatible with Full Site Editing.' ) );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span></span></pre></div>
<a id="trunksrcwpadminthemeeditorphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-admin/theme-editor.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-admin/theme-editor.php 2021-12-06 22:40:45 UTC (rev 52329)
+++ trunk/src/wp-admin/theme-editor.php 2021-12-07 00:00:45 UTC (rev 52330)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -196,7 +196,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> </div>
</span><span class="cx" style="display: block; padding: 0 10px"> <?php endif; ?>
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-<?php if ( preg_match( '/\.css$/', $file ) && ! wp_is_block_template_theme() && current_user_can( 'customize' ) ) : ?>
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+<?php if ( preg_match( '/\.css$/', $file ) && ! wp_is_block_theme() && current_user_can( 'customize' ) ) : ?>
</ins><span class="cx" style="display: block; padding: 0 10px"> <div id="message" class="notice-info notice">
</span><span class="cx" style="display: block; padding: 0 10px"> <p><strong><?php _e( 'Did you know?' ); ?></strong></p>
</span><span class="cx" style="display: block; padding: 0 10px"> <p>
</span></span></pre></div>
<a id="trunksrcwpincludesadminbarphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/admin-bar.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/admin-bar.php 2021-12-06 22:40:45 UTC (rev 52329)
+++ trunk/src/wp-includes/admin-bar.php 2021-12-07 00:00:45 UTC (rev 52330)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -417,7 +417,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> function wp_admin_bar_edit_site_menu( $wp_admin_bar ) {
</span><span class="cx" style="display: block; padding: 0 10px"> // Don't show if a block theme is not activated.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( ! wp_is_block_template_theme() ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( ! wp_is_block_theme() ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> return;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -447,7 +447,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> global $wp_customize;
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // Don't show if a block theme is activated.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( wp_is_block_template_theme() ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( wp_is_block_theme() ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> return;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span></span></pre></div>
<a id="trunksrcwpincludesclasswpthemephp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/class-wp-theme.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/class-wp-theme.php 2021-12-06 22:40:45 UTC (rev 52329)
+++ trunk/src/wp-includes/class-wp-theme.php 2021-12-07 00:00:45 UTC (rev 52330)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1467,7 +1467,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @return bool
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- public function is_block_based() {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ public function is_block_theme() {
</ins><span class="cx" style="display: block; padding: 0 10px"> $paths_to_index_block_template = array(
</span><span class="cx" style="display: block; padding: 0 10px"> $this->get_file_path( '/block-templates/index.html' ),
</span><span class="cx" style="display: block; padding: 0 10px"> $this->get_file_path( '/templates/index.html' ),
</span></span></pre></div>
<a id="trunksrcwpincludespostphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/post.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/post.php 2021-12-06 22:40:45 UTC (rev 52329)
+++ trunk/src/wp-includes/post.php 2021-12-07 00:00:45 UTC (rev 52330)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -356,7 +356,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 'public' => false,
</span><span class="cx" style="display: block; padding: 0 10px"> '_builtin' => true, /* internal use only. don't use this when registering your own post type. */
</span><span class="cx" style="display: block; padding: 0 10px"> 'has_archive' => false,
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'show_ui' => wp_is_block_template_theme(),
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'show_ui' => wp_is_block_theme(),
</ins><span class="cx" style="display: block; padding: 0 10px"> 'show_in_menu' => false,
</span><span class="cx" style="display: block; padding: 0 10px"> 'show_in_rest' => true,
</span><span class="cx" style="display: block; padding: 0 10px"> 'rewrite' => false,
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -416,7 +416,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 'public' => false,
</span><span class="cx" style="display: block; padding: 0 10px"> '_builtin' => true, /* internal use only. don't use this when registering your own post type. */
</span><span class="cx" style="display: block; padding: 0 10px"> 'has_archive' => false,
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'show_ui' => wp_is_block_template_theme(),
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'show_ui' => wp_is_block_theme(),
</ins><span class="cx" style="display: block; padding: 0 10px"> 'show_in_menu' => false,
</span><span class="cx" style="display: block; padding: 0 10px"> 'show_in_rest' => true,
</span><span class="cx" style="display: block; padding: 0 10px"> 'rewrite' => false,
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -503,7 +503,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 'public' => false,
</span><span class="cx" style="display: block; padding: 0 10px"> '_builtin' => true, /* internal use only. don't use this when registering your own post type. */
</span><span class="cx" style="display: block; padding: 0 10px"> 'has_archive' => false,
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'show_ui' => wp_is_block_template_theme(),
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'show_ui' => wp_is_block_theme(),
</ins><span class="cx" style="display: block; padding: 0 10px"> 'show_in_menu' => 'themes.php',
</span><span class="cx" style="display: block; padding: 0 10px"> 'show_in_admin_bar' => false,
</span><span class="cx" style="display: block; padding: 0 10px"> 'show_in_rest' => true,
</span></span></pre></div>
<a id="trunksrcwpincludesthemephp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/theme.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/theme.php 2021-12-06 22:40:45 UTC (rev 52329)
+++ trunk/src/wp-includes/theme.php 2021-12-07 00:00:45 UTC (rev 52330)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -4090,7 +4090,6 @@
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @return boolean Whether the current theme is a block-based theme or not.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-function wp_is_block_template_theme() {
- return is_readable( get_theme_file_path( '/block-templates/index.html' ) ) ||
- is_readable( get_theme_file_path( '/templates/index.html' ) );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+function wp_is_block_theme() {
+ return wp_get_theme()->is_block_theme();
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span></span></pre></div>
<a id="trunktestsphpunitteststhemewpThemephp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/tests/phpunit/tests/theme/wpTheme.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/tests/theme/wpTheme.php 2021-12-06 22:40:45 UTC (rev 52329)
+++ trunk/tests/phpunit/tests/theme/wpTheme.php 2021-12-07 00:00:45 UTC (rev 52330)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -248,23 +248,17 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @dataProvider data_is_block_based
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @dataProvider data_is_block_theme
</ins><span class="cx" style="display: block; padding: 0 10px"> * @ticket 54460
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @covers WP_Theme::is_block_based
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @covers WP_Theme::is_block_theme
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @param string $theme_dir Directory of the theme to test.
</span><span class="cx" style="display: block; padding: 0 10px"> * @param bool $expected Expected result.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- public function test_is_block_based( $theme_dir, $expected ) {
- $theme = new WP_Theme( $theme_dir, $this->theme_root );
- $actual = $theme->is_block_based();
-
- if ( $expected ) {
- $this->assertTrue( $actual );
- } else {
- $this->assertFalse( $actual );
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ public function test_is_block_theme( $theme_dir, $expected ) {
+ $theme = new WP_Theme( $theme_dir, $this->theme_root );
+ $this->assertSame( $expected, $theme->is_block_theme() );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -272,7 +266,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @return array
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- public function data_is_block_based() {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ public function data_is_block_theme() {
</ins><span class="cx" style="display: block; padding: 0 10px"> return array(
</span><span class="cx" style="display: block; padding: 0 10px"> 'default - non-block theme' => array(
</span><span class="cx" style="display: block; padding: 0 10px"> 'theme_dir' => 'default',
</span></span></pre>
</div>
</div>
</body>
</html>