Changeset 52330
- Timestamp:
- 12/07/2021 12:00:45 AM (3 years ago)
- Location:
- trunk
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/dashboard.php
r52279 r52330 1994 1994 $can_edit_theme_options = current_user_can( 'edit_theme_options' ); 1995 1995 $can_customize = current_user_can( 'customize' ); 1996 $is_block_ based_theme = wp_is_block_template_theme();1997 1998 if ( $is_block_ based_theme && $can_edit_theme_options ) {1996 $is_block_theme = wp_is_block_theme(); 1997 1998 if ( $is_block_theme && $can_edit_theme_options ) { 1999 1999 $customize_url = esc_url( admin_url( 'site-editor.php' ) ); 2000 } elseif ( ! $is_block_ based_theme && $can_customize ) {2000 } elseif ( ! $is_block_theme && $can_customize ) { 2001 2001 $customize_url = wp_customize_url(); 2002 2002 } … … 2013 2013 <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> 2014 2014 <?php if ( current_user_can( 'install_themes' ) || ( current_user_can( 'switch_themes' ) && count( wp_get_themes( array( 'allowed' => true ) ) ) > 1 ) ) : ?> 2015 <?php $themes_link = $can_customize && ! $is_block_ based_theme ? add_query_arg( 'autofocus[panel]', 'themes', admin_url( 'customize.php' ) ) : admin_url( 'themes.php' ); ?>2015 <?php $themes_link = $can_customize && ! $is_block_theme ? add_query_arg( 'autofocus[panel]', 'themes', admin_url( 'customize.php' ) ) : admin_url( 'themes.php' ); ?> 2016 2016 <p class="hide-if-no-customize"> 2017 2017 <?php -
trunk/src/wp-admin/includes/theme.php
r52279 r52330 705 705 $can_edit_theme_options = current_user_can( 'edit_theme_options' ); 706 706 $can_customize = current_user_can( 'customize' ); 707 $is_block_ based_theme = $theme->is_block_based();708 709 if ( $is_block_ based_theme && $can_edit_theme_options ) {707 $is_block_theme = $theme->is_block_theme(); 708 709 if ( $is_block_theme && $can_edit_theme_options ) { 710 710 $customize_action = esc_url( admin_url( 'site-editor.php' ) ); 711 } elseif ( ! $is_block_ based_theme && $can_customize && $can_edit_theme_options ) {711 } elseif ( ! $is_block_theme && $can_customize && $can_edit_theme_options ) { 712 712 $customize_action = esc_url( 713 713 add_query_arg( -
trunk/src/wp-admin/menu.php
r52232 r52330 203 203 $submenu['themes.php'][5] = array( sprintf( __( 'Themes %s' ), $count ), $appearance_cap, 'themes.php' ); 204 204 205 if ( wp_is_block_t emplate_theme() ) {205 if ( wp_is_block_theme() ) { 206 206 $submenu['themes.php'][6] = array( 207 207 sprintf( … … 217 217 // Hide Customize link on block themes unless a plugin or theme is using 218 218 // customize_register to add a setting. 219 if ( ! wp_is_block_t emplate_theme() || has_action( 'customize_register' ) ) {219 if ( ! wp_is_block_theme() || has_action( 'customize_register' ) ) { 220 220 $customize_url = add_query_arg( 'return', urlencode( remove_query_arg( wp_removable_query_args(), wp_unslash( $_SERVER['REQUEST_URI'] ) ) ), 'customize.php' ); 221 $position = wp_is_block_t emplate_theme() ? 7 : 6;221 $position = wp_is_block_theme() ? 7 : 6; 222 222 223 223 $submenu['themes.php'][ $position ] = array( __( 'Customize' ), 'customize', esc_url( $customize_url ), '', 'hide-if-no-customize' ); … … 256 256 function _add_themes_utility_last() { 257 257 add_submenu_page( 258 wp_is_block_t emplate_theme() ? 'tools.php' : 'themes.php',258 wp_is_block_theme() ? 'tools.php' : 'themes.php', 259 259 __( 'Theme Editor' ), 260 260 __( 'Theme Editor' ), -
trunk/src/wp-admin/site-editor.php
r52281 r52330 20 20 } 21 21 22 if ( ! wp_is_block_t emplate_theme() ) {22 if ( ! wp_is_block_theme() ) { 23 23 wp_die( __( 'The theme you are currently using is not compatible with Full Site Editing.' ) ); 24 24 } -
trunk/src/wp-admin/theme-editor.php
r52279 r52330 197 197 <?php endif; ?> 198 198 199 <?php if ( preg_match( '/\.css$/', $file ) && ! wp_is_block_t emplate_theme() && current_user_can( 'customize' ) ) : ?>199 <?php if ( preg_match( '/\.css$/', $file ) && ! wp_is_block_theme() && current_user_can( 'customize' ) ) : ?> 200 200 <div id="message" class="notice-info notice"> 201 201 <p><strong><?php _e( 'Did you know?' ); ?></strong></p> -
trunk/src/wp-includes/admin-bar.php
r52158 r52330 418 418 function wp_admin_bar_edit_site_menu( $wp_admin_bar ) { 419 419 // Don't show if a block theme is not activated. 420 if ( ! wp_is_block_t emplate_theme() ) {420 if ( ! wp_is_block_theme() ) { 421 421 return; 422 422 } … … 448 448 449 449 // Don't show if a block theme is activated. 450 if ( wp_is_block_t emplate_theme() ) {450 if ( wp_is_block_theme() ) { 451 451 return; 452 452 } -
trunk/src/wp-includes/class-wp-theme.php
r52297 r52330 1468 1468 * @return bool 1469 1469 */ 1470 public function is_block_ based() {1470 public function is_block_theme() { 1471 1471 $paths_to_index_block_template = array( 1472 1472 $this->get_file_path( '/block-templates/index.html' ), -
trunk/src/wp-includes/post.php
r52275 r52330 357 357 '_builtin' => true, /* internal use only. don't use this when registering your own post type. */ 358 358 'has_archive' => false, 359 'show_ui' => wp_is_block_t emplate_theme(),359 'show_ui' => wp_is_block_theme(), 360 360 'show_in_menu' => false, 361 361 'show_in_rest' => true, … … 417 417 '_builtin' => true, /* internal use only. don't use this when registering your own post type. */ 418 418 'has_archive' => false, 419 'show_ui' => wp_is_block_t emplate_theme(),419 'show_ui' => wp_is_block_theme(), 420 420 'show_in_menu' => false, 421 421 'show_in_rest' => true, … … 504 504 '_builtin' => true, /* internal use only. don't use this when registering your own post type. */ 505 505 'has_archive' => false, 506 'show_ui' => wp_is_block_t emplate_theme(),506 'show_ui' => wp_is_block_theme(), 507 507 'show_in_menu' => 'themes.php', 508 508 'show_in_admin_bar' => false, -
trunk/src/wp-includes/theme.php
r52256 r52330 4091 4091 * @return boolean Whether the current theme is a block-based theme or not. 4092 4092 */ 4093 function wp_is_block_template_theme() { 4094 return is_readable( get_theme_file_path( '/block-templates/index.html' ) ) || 4095 is_readable( get_theme_file_path( '/templates/index.html' ) ); 4096 } 4093 function wp_is_block_theme() { 4094 return wp_get_theme()->is_block_theme(); 4095 } -
trunk/tests/phpunit/tests/theme/wpTheme.php
r52279 r52330 249 249 250 250 /** 251 * @dataProvider data_is_block_ based251 * @dataProvider data_is_block_theme 252 252 * @ticket 54460 253 253 * 254 * @covers WP_Theme::is_block_ based254 * @covers WP_Theme::is_block_theme 255 255 * 256 256 * @param string $theme_dir Directory of the theme to test. 257 257 * @param bool $expected Expected result. 258 258 */ 259 public function test_is_block_based( $theme_dir, $expected ) { 260 $theme = new WP_Theme( $theme_dir, $this->theme_root ); 261 $actual = $theme->is_block_based(); 262 263 if ( $expected ) { 264 $this->assertTrue( $actual ); 265 } else { 266 $this->assertFalse( $actual ); 267 } 259 public function test_is_block_theme( $theme_dir, $expected ) { 260 $theme = new WP_Theme( $theme_dir, $this->theme_root ); 261 $this->assertSame( $expected, $theme->is_block_theme() ); 268 262 } 269 263 … … 273 267 * @return array 274 268 */ 275 public function data_is_block_ based() {269 public function data_is_block_theme() { 276 270 return array( 277 271 'default - non-block theme' => array(
Note: See TracChangeset
for help on using the changeset viewer.