Changeset 51003
- Timestamp:
- 05/25/2021 02:19:14 PM (3 years ago)
- Location:
- trunk
- Files:
-
- 9 added
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/edit-form-blocks.php
r50996 r51003 221 221 '__experimentalBlockPatterns' => WP_Block_Patterns_Registry::get_instance()->get_all_registered(), 222 222 '__experimentalBlockPatternCategories' => WP_Block_Pattern_Categories_Registry::get_instance()->get_all_registered(), 223 'supportsTemplateMode' => current_theme_supports( 'block-templates' ), 223 224 224 225 // Whether or not to load the 'postcustom' meta box is stored as a user meta -
trunk/src/wp-includes/class-wp-theme.php
r50810 r51003 1183 1183 * 1184 1184 * @since 4.7.0 1185 * @since 5.8.0 Include block templates. 1185 1186 * 1186 1187 * @return string[] Array of page templates, keyed by filename and post type, … … 1217 1218 1218 1219 $post_templates[ $type ][ $file ] = _cleanup_header_comment( $header[1] ); 1220 } 1221 } 1222 1223 if ( current_theme_supports( 'block-templates' ) ) { 1224 $block_templates = get_block_templates( array(), 'wp_template' ); 1225 foreach ( get_post_types( array( 'public' => true ) ) as $type ) { 1226 foreach ( $block_templates as $block_template ) { 1227 $post_templates[ $type ][ $block_template->slug ] = $block_template->title; 1228 } 1219 1229 } 1220 1230 } -
trunk/src/wp-includes/default-filters.php
r50973 r51003 556 556 add_action( 'wp_footer', 'wp_maybe_inline_styles', 1 ); // Run for late-loaded styles in the footer. 557 557 558 add_action( 'admin_footer-post.php', 'wp_add_iframed_editor_assets_html' ); 559 add_action( 'admin_footer-post-new.php', 'wp_add_iframed_editor_assets_html' ); 560 558 561 // Taxonomy. 559 562 add_action( 'init', 'create_initial_taxonomies', 0 ); // Highest priority. … … 634 637 add_filter( 'user_has_cap', 'wp_maybe_grant_site_health_caps', 1, 4 ); 635 638 639 // Block Templates CPT and Rendering 640 add_filter( 'render_block_context', '_block_template_render_without_post_block_context' ); 641 add_filter( 'pre_wp_unique_post_slug', 'wp_filter_wp_template_unique_post_slug', 10, 5 ); 642 add_action( 'wp_footer', 'the_block_template_skip_link' ); 643 636 644 unset( $filter, $action ); -
trunk/src/wp-includes/post.php
r50935 r51003 305 305 'supports' => array( 306 306 'title', 307 'editor', 308 'revisions', 309 ), 310 ) 311 ); 312 313 register_post_type( 314 'wp_template', 315 array( 316 'labels' => array( 317 'name' => __( 'Templates' ), 318 'singular_name' => __( 'Template' ), 319 'menu_name' => _x( 'Templates', 'Admin Menu text' ), 320 'add_new' => _x( 'Add New', 'Template' ), 321 'add_new_item' => __( 'Add New Template' ), 322 'new_item' => __( 'New Template' ), 323 'edit_item' => __( 'Edit Template' ), 324 'view_item' => __( 'View Template' ), 325 'all_items' => __( 'All Templates' ), 326 'search_items' => __( 'Search Templates' ), 327 'parent_item_colon' => __( 'Parent Template:' ), 328 'not_found' => __( 'No templates found.' ), 329 'not_found_in_trash' => __( 'No templates found in Trash.' ), 330 'archives' => __( 'Template archives' ), 331 'insert_into_item' => __( 'Insert into template' ), 332 'uploaded_to_this_item' => __( 'Uploaded to this template' ), 333 'filter_items_list' => __( 'Filter templates list' ), 334 'items_list_navigation' => __( 'Templates list navigation' ), 335 'items_list' => __( 'Templates list' ), 336 ), 337 'description' => __( 'Templates to include in your theme.' ), 338 'public' => false, 339 'has_archive' => false, 340 'show_ui' => false, 341 'show_in_menu' => false, 342 'show_in_admin_bar' => false, 343 'show_in_rest' => true, 344 'rewrite' => false, 345 'rest_base' => 'templates', 346 'rest_controller_class' => 'WP_REST_Templates_Controller', 347 'capability_type' => array( 'template', 'templates' ), 348 'capabilities' => array( 349 'create_posts' => 'edit_theme_options', 350 'delete_posts' => 'edit_theme_options', 351 'delete_others_posts' => 'edit_theme_options', 352 'delete_private_posts' => 'edit_theme_options', 353 'delete_published_posts' => 'edit_theme_options', 354 'edit_posts' => 'edit_theme_options', 355 'edit_others_posts' => 'edit_theme_options', 356 'edit_private_posts' => 'edit_theme_options', 357 'edit_published_posts' => 'edit_theme_options', 358 'publish_posts' => 'edit_theme_options', 359 'read' => 'edit_theme_options', 360 'read_private_posts' => 'edit_theme_options', 361 ), 362 'map_meta_cap' => true, 363 'supports' => array( 364 'title', 365 'slug', 366 'excerpt', 307 367 'editor', 308 368 'revisions', -
trunk/src/wp-includes/script-loader.php
r51001 r51003 2663 2663 } 2664 2664 } 2665 2666 /** 2667 * Inject the block editor assets that need to be loaded into the editor's iframe as an inline script. 2668 * 2669 * @since 5.8.0 2670 */ 2671 function wp_add_iframed_editor_assets_html() { 2672 $script_handles = array(); 2673 $style_handles = array( 2674 'wp-block-editor', 2675 'wp-block-library', 2676 'wp-block-library-theme', 2677 'wp-edit-blocks', 2678 ); 2679 2680 $block_registry = WP_Block_Type_Registry::get_instance(); 2681 2682 foreach ( $block_registry->get_all_registered() as $block_type ) { 2683 if ( ! empty( $block_type->style ) ) { 2684 $style_handles[] = $block_type->style; 2685 } 2686 2687 if ( ! empty( $block_type->editor_style ) ) { 2688 $style_handles[] = $block_type->editor_style; 2689 } 2690 2691 if ( ! empty( $block_type->script ) ) { 2692 $script_handles[] = $block_type->script; 2693 } 2694 } 2695 2696 $style_handles = array_unique( $style_handles ); 2697 $done = wp_styles()->done; 2698 2699 ob_start(); 2700 2701 wp_styles()->done = array(); 2702 wp_styles()->do_items( $style_handles ); 2703 wp_styles()->done = $done; 2704 2705 $styles = ob_get_clean(); 2706 2707 $script_handles = array_unique( $script_handles ); 2708 $done = wp_scripts()->done; 2709 2710 ob_start(); 2711 2712 wp_scripts()->done = array(); 2713 wp_scripts()->do_items( $script_handles ); 2714 wp_scripts()->done = $done; 2715 2716 $scripts = ob_get_clean(); 2717 2718 $editor_assets = wp_json_encode( 2719 array( 2720 'styles' => $styles, 2721 'scripts' => $scripts, 2722 ) 2723 ); 2724 2725 echo "<script>window.__editorAssets = $editor_assets</script>"; 2726 } -
trunk/src/wp-includes/taxonomy.php
r50935 r51003 171 171 '_builtin' => true, 172 172 'show_in_nav_menus' => current_theme_supports( 'post-formats' ), 173 ) 174 ); 175 176 register_taxonomy( 177 'wp_theme', 178 array( 'wp_template' ), 179 array( 180 'public' => false, 181 'hierarchical' => false, 182 'labels' => array( 183 'name' => __( 'Themes' ), 184 'singular_name' => __( 'Theme' ), 185 ), 186 'query_var' => false, 187 'rewrite' => false, 188 'show_ui' => false, 189 '_builtin' => true, 190 'show_in_nav_menus' => false, 191 'show_in_rest' => false, 173 192 ) 174 193 ); -
trunk/src/wp-includes/template.php
r50505 r51003 64 64 $template = locate_template( $templates ); 65 65 66 $template = locate_block_template( $template, $type, $templates ); 67 66 68 /** 67 69 * Filters the path of the queried template by type. -
trunk/src/wp-settings.php
r51001 r51003 171 171 require ABSPATH . WPINC . '/theme.php'; 172 172 require ABSPATH . WPINC . '/class-wp-theme.php'; 173 require ABSPATH . WPINC . '/class-wp-block-template.php'; 174 require ABSPATH . WPINC . '/block-template-utils.php'; 175 require ABSPATH . WPINC . '/block-template.php'; 176 require ABSPATH . WPINC . '/theme-templates.php'; 173 177 require ABSPATH . WPINC . '/template.php'; 174 178 require ABSPATH . WPINC . '/https-detection.php'; … … 269 273 require ABSPATH . WPINC . '/rest-api/endpoints/class-wp-rest-widget-types-controller.php'; 270 274 require ABSPATH . WPINC . '/rest-api/endpoints/class-wp-rest-widgets-controller.php'; 275 require ABSPATH . WPINC . '/rest-api/endpoints/class-wp-rest-templates-controller.php'; 271 276 require ABSPATH . WPINC . '/rest-api/fields/class-wp-rest-meta-fields.php'; 272 277 require ABSPATH . WPINC . '/rest-api/fields/class-wp-rest-comment-meta-fields.php'; -
trunk/tests/phpunit/tests/rest-api/rest-schema-setup.php
r50995 r51003 130 130 '/wp/v2/block-types/(?P<namespace>[a-zA-Z0-9_-]+)/(?P<name>[a-zA-Z0-9_-]+)', 131 131 '/wp/v2/settings', 132 '/wp/v2/templates', 133 '/wp/v2/templates/(?P<id>[\/\w-]+)', 134 '/wp/v2/templates/(?P<id>[\d]+)/autosaves', 135 '/wp/v2/templates/(?P<parent>[\d]+)/autosaves/(?P<id>[\d]+)', 136 '/wp/v2/templates/(?P<parent>[\d]+)/revisions', 137 '/wp/v2/templates/(?P<parent>[\d]+)/revisions/(?P<id>[\d]+)', 132 138 '/wp/v2/themes', 133 139 '/wp/v2/themes/(?P<stylesheet>[\w-]+)', -
trunk/tests/phpunit/tests/theme/wpThemeJson.php
r50977 r51003 6 6 * @package WordPress 7 7 * @subpackage Theme 8 * 8 9 * @since 5.8.0 9 10 * -
trunk/tests/phpunit/tests/theme/wpThemeJsonResolver.php
r50967 r51003 6 6 * @package WordPress 7 7 * @subpackage Theme 8 * 8 9 * @since 5.8.0 9 10 *
Note: See TracChangeset
for help on using the changeset viewer.