WordPress.org

Make WordPress Core

Opened 5 weeks ago

Closed 5 weeks ago

Last modified 5 weeks ago

#54679 closed defect (bug) (fixed)

Add missing default template areas to the Page/Post Editor settings

Reported by: Mamaduka Owned by: SergeyBiryukov
Milestone: 5.9 Priority: normal
Severity: normal Version: trunk
Component: Editor Keywords: has-patch
Focuses: Cc:

Description (last modified by costdev)

The default template area settings shown when editing a template in the "Post/Page" editor got lost during backporting for 5.9.

In the Gutenberg plugin, we're filtering block_editor_settings_all to add this setting for block themes - https://github.com/WordPress/gutenberg/blob/trunk/lib/editor-settings.php#L20-L32.

Testing

Running following snippet in DevTools console currently returns an empty array:

wp.data.select('core/editor').__experimentalGetDefaultTemplatePartAreas();

After the fix, it should return the following values:

[
    {
        "area": "uncategorized",
        "label": "General",
        "description": "General templates often perform a specific role like displaying post content, and are not tied to any particular area.",
        "icon": {},
        "area_tag": "div"
    },
    {
        "area": "header",
        "label": "Header",
        "description": "The Header template defines a page area that typically contains a title, logo, and main navigation.",
        "icon": {},
        "area_tag": "header"
    },
    {
        "area": "footer",
        "label": "Footer",
        "description": "The Footer template defines a page area that typically contains site credits, social links, or any other combination of blocks.",
        "icon": {},
        "area_tag": "footer"
    }
]

Change History (6)

This ticket was mentioned in PR #2076 on WordPress/wordpress-develop by Mamaduka.


5 weeks ago

  • Keywords has-patch added

Testing instructions can be found in the Trac ticket.

I've not added this setting to the get_default_block_editor_settings since Template Parts are only supported in the Template Editing Mode.

Gutenberg issue: https://github.com/WordPress/gutenberg/issues/37443
Trac ticket: https://core.trac.wordpress.org/ticket/54679

/cc @gziolo, @hellofromtonya

#2 @costdev
5 weeks ago

  • Description modified (diff)
  • Summary changed from Add missing default template areas to the editor settings to Add missing default template areas to the Page/Post Editor settings

#3 @costdev
5 weeks ago

Test Report

Env

  • WordPress 5.9 Beta 4
  • Chrome 96.0.4664.110
  • Windows 10 (Local)
  • Theme: Twenty Twenty-Two
  • Plugin: None activated

Steps to test

  1. Enable a block theme, such as Twenty Twenty-Two.
  2. Navigate to Pages > Add New.
  3. To the right, expand the Template section.
  4. Click Edit.
  5. Insert a Template Part.
  6. Click Choose existing. In the AREA: headings, you should see UNDEFINED.
  7. Apply PR 2076.
  8. Repeat steps 2-6. The AREA: headings should now show the correct name.

Results

  • Before PR 2076: UNDEFINED is shown.
  • After PR 2076: The correct name is shown.
  • PR works as expected 👍

#4 @SergeyBiryukov
5 weeks ago

  • Milestone changed from Awaiting Review to 5.9

#5 @SergeyBiryukov
5 weeks ago

  • Owner set to SergeyBiryukov
  • Resolution set to fixed
  • Status changed from new to closed

In 52409:

Editor: Add missing default template areas to the post/page editor settings.

This ensures that default template area settings are displayed when editing a template in the post/page editor, which previously got lost during backporting for 5.9.

Follow-up to [52232].

Props Mamaduka, costdev, gziolo.
Fixes #54679.

Note: See TracTickets for help on using tickets.