Changeset 54176
- Timestamp:
- 09/15/2022 12:18:30 PM (2 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/menu.php
r54165 r54176 215 215 } 216 216 217 if ( ! wp_is_block_theme() && current_theme_supports( 'block-template-parts' ) ) { 218 $submenu['themes.php'][6] = array( 219 __( 'Template Parts' ), 220 'edit_theme_options', 221 'site-editor.php?postType=wp_template_part', 222 ); 223 } 224 217 225 $customize_url = add_query_arg( 'return', urlencode( remove_query_arg( wp_removable_query_args(), wp_unslash( $_SERVER['REQUEST_URI'] ) ) ), 'customize.php' ); 218 226 … … 220 228 // is using 'customize_register' to add a setting. 221 229 if ( ! wp_is_block_theme() || has_action( 'customize_register' ) ) { 222 $position = wp_is_block_theme() ? 7 : 6;230 $position = ( wp_is_block_theme() || current_theme_supports( 'block-template-parts' ) ) ? 7 : 6; 223 231 224 232 $submenu['themes.php'][ $position ] = array( __( 'Customize' ), 'customize', esc_url( $customize_url ), '', 'hide-if-no-customize' ); -
trunk/src/wp-admin/site-editor.php
r53784 r54176 20 20 } 21 21 22 if ( ! wp_is_block_theme() ) {22 if ( ! ( current_theme_supports( 'block-template-parts' ) || wp_is_block_theme() ) ) { 23 23 wp_die( __( 'The theme you are currently using is not compatible with Full Site Editing.' ) ); 24 } 25 26 $is_template_part_editor = isset( $_GET['postType'] ) && 'wp_template_part' === sanitize_key( $_GET['postType'] ); 27 if ( ! wp_is_block_theme() && ! $is_template_part_editor ) { 28 wp_die( __( 'The theme you are currently using is not compatible with the Site Editor.' ) ); 24 29 } 25 30 … … 65 70 $block_editor_context = new WP_Block_Editor_Context( array( 'name' => 'core/edit-site' ) ); 66 71 $custom_settings = array( 67 'siteUrl' => site_url(), 68 'postsPerPage' => get_option( 'posts_per_page' ), 69 'styles' => get_block_editor_theme_styles(), 70 'defaultTemplateTypes' => $indexed_template_types, 71 'defaultTemplatePartAreas' => get_allowed_block_template_part_areas(), 72 '__unstableHomeTemplate' => $home_template, 72 'siteUrl' => site_url(), 73 'postsPerPage' => get_option( 'posts_per_page' ), 74 'styles' => get_block_editor_theme_styles(), 75 'defaultTemplateTypes' => $indexed_template_types, 76 'defaultTemplatePartAreas' => get_allowed_block_template_part_areas(), 77 'supportsLayout' => WP_Theme_JSON_Resolver::theme_has_support(), 78 'supportsTemplatePartsMode' => ! wp_is_block_theme() && current_theme_supports( 'block-template-parts' ), 79 '__unstableHomeTemplate' => $home_template, 73 80 ); 81 82 /** 83 * Home template resolution is not needed when block template parts are supported. 84 * Set the value to `true` to satisfy the editor initialization guard clause. 85 */ 86 if ( $custom_settings['supportsTemplatePartsMode'] ) { 87 $custom_settings['__unstableHomeTemplate'] = true; 88 } 74 89 75 90 // Add additional back-compat patterns registered by `current_screen` et al. -
trunk/src/wp-includes/functions.php
r54157 r54176 5262 5262 5263 5263 $menu_name = __( 'Widgets' ); 5264 if ( wp_is_block_theme() ) {5264 if ( wp_is_block_theme() || current_theme_supports( 'block-template-parts' ) ) { 5265 5265 $submenu['themes.php'][] = array( $menu_name, 'edit_theme_options', 'widgets.php' ); 5266 5266 } else { -
trunk/src/wp-includes/theme.php
r54174 r54176 3845 3845 ); 3846 3846 register_theme_feature( 3847 'block-template-parts', 3848 array( 3849 'description' => __( 'Whether a theme uses block-based template parts.' ), 3850 'show_in_rest' => true, 3851 ) 3852 ); 3853 register_theme_feature( 3847 3854 'custom-background', 3848 3855 array( -
trunk/tests/phpunit/tests/rest-api/rest-themes-controller.php
r54162 r54176 389 389 $this->assertArrayHasKey( 'automatic-feed-links', $theme_supports ); 390 390 $this->assertArrayHasKey( 'block-templates', $theme_supports ); 391 $this->assertArrayHasKey( 'block-template-parts', $theme_supports, "Theme supports should have 'block-template-parts' key" ); 391 392 $this->assertArrayHasKey( 'custom-header', $theme_supports ); 392 393 $this->assertArrayHasKey( 'custom-background', $theme_supports ); … … 408 409 $this->assertArrayHasKey( 'title-tag', $theme_supports ); 409 410 $this->assertArrayHasKey( 'wp-block-styles', $theme_supports ); 410 $this->assertCount( 2 2, $theme_supports);411 $this->assertCount( 23, $theme_supports, 'There should be 23 theme supports' ); 411 412 } 412 413
Note: See TracChangeset
for help on using the changeset viewer.