Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Template part areas display as "undefined" in the template editor #37443

Closed
carolinan opened this issue Dec 16, 2021 · 10 comments
Closed

Template part areas display as "undefined" in the template editor #37443

carolinan opened this issue Dec 16, 2021 · 10 comments
Labels
[Block] Template Part Affects the Template Parts Block [Feature] Template Editing Mode Related to the template editor available in the Block Editor

Comments

@carolinan
Copy link
Contributor

Description

When you add a template part in the template editor, (either template part, header, or footer aliases) and select "Choose existing",
the area displays as "Undefined".

Step-by-step reproduction instructions

  1. Activate a theme with support for template editing, for example Twenty Twenty-Two
  2. Open a template in the template editor
  3. Add a template part. Select "Choose existing"
  4. See that the area is undefined.

Screenshots, screen recording, code snippet

A template part block is added in the template editor, but the area is "undefined" instead of the registered header area

Environment info

WordPress 5.9.0 beta 3 via the beta tester
With and without Gutenberg trunk.

Please confirm that you have searched existing issues in the repo.

Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

No

@carolinan carolinan added the [Feature] Template Editing Mode Related to the template editor available in the Block Editor label Dec 16, 2021
@Mamaduka
Copy link
Member

I think we forgot to backport this part of the editor settings into the WP core. I'm not able to reproduce this with the Gutenberg trunk.

if ( wp_is_block_theme() ) {
$settings['defaultTemplatePartAreas'] = get_allowed_block_template_part_areas();
}

@carolinan
Copy link
Contributor Author

carolinan commented Dec 20, 2021

@carolinan carolinan added the Backport to WP 6.7 Beta/RC Pull request that needs to be backported to the WordPress major release that's currently in beta label Dec 20, 2021
@tellthemachines
Copy link
Contributor

I can't reproduce this locally with WP trunk plus the package updates for Beta 4.

@hellofromtonya
Copy link
Contributor

WordPress Core's changeset 52232 added the defaultTemplatePartAreas setting:

$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'                 => $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(),
);
$editor_settings      = get_block_editor_settings( $custom_settings, $block_editor_context );

I'm not seeing other changes to that setting in Core since that commit.

And get_allowed_block_template_part_areas() was committed 6 weeks ago with changeset 52062.

@hellofromtonya
Copy link
Contributor

Removing the backport label until the needed backport is identified.

@hellofromtonya hellofromtonya removed the Backport to WP 6.7 Beta/RC Pull request that needs to be backported to the WordPress major release that's currently in beta label Dec 21, 2021
@carolinan
Copy link
Contributor Author

Changeset 52232 changes wp-admin/site-editor.php, is that used for the template editor? Which is part of the block editor, not the site editor.

@carolinan
Copy link
Contributor Author

I can't reproduce this locally with WP trunk plus the package updates for Beta 4.

How did you add the template part? I am still unable to add a template part block using 5.9-beta4-52408-src.

@carolinan carolinan added the [Block] Template Part Affects the Template Parts Block label Dec 22, 2021
@Mamaduka
Copy link
Member

I was able to reproduce this with beta 4. It should be fixed via a core patch, and I will create it shortly.

@Mamaduka
Copy link
Member

Core PR: WordPress/wordpress-develop#2076

@Mamaduka
Copy link
Member

The core patch got merged - https://core.trac.wordpress.org/changeset/52409.

I am closing the issue since there's no change required on the plugin side.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Template Part Affects the Template Parts Block [Feature] Template Editing Mode Related to the template editor available in the Block Editor
Projects
None yet
Development

No branches or pull requests

4 participants