From eb1763d2af42a61c7c942a829c1316af95588546 Mon Sep 17 00:00:00 2001 From: Riad Benguella Date: Tue, 7 Dec 2021 16:38:47 +0000 Subject: [PATCH] Site Editor: Render the template descriptions properly. The initializaion of the editor was a bit different between Gutenberg and Core. This brings them in sync which solves the missing descriptions from the template header in the site editor. See #54337. git-svn-id: https://develop.svn.wordpress.org/trunk@52336 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/site-editor.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/wp-admin/site-editor.php b/src/wp-admin/site-editor.php index 64abbdb0cd..6100f5a310 100644 --- a/src/wp-admin/site-editor.php +++ b/src/wp-admin/site-editor.php @@ -37,12 +37,18 @@ add_filter( } ); +$indexed_template_types = array(); +foreach ( get_default_block_template_types() as $slug => $template_type ) { + $template_type['slug'] = (string) $slug; + $indexed_template_types[] = $template_type; +} + $block_editor_context = new WP_Block_Editor_Context(); $custom_settings = array( 'siteUrl' => site_url(), 'postsPerPage' => get_option( 'posts_per_page' ), 'styles' => get_block_editor_theme_styles(), - 'defaultTemplateTypes' => get_default_block_template_types(), + 'defaultTemplateTypes' => $indexed_template_types, 'defaultTemplatePartAreas' => get_allowed_block_template_part_areas(), '__experimentalBlockPatterns' => WP_Block_Patterns_Registry::get_instance()->get_all_registered(), '__experimentalBlockPatternCategories' => WP_Block_Pattern_Categories_Registry::get_instance()->get_all_registered(),