-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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 - register block variations and area selection inputs from original area definitions. #30821
Template part - register block variations and area selection inputs from original area definitions. #30821
Conversation
Size Change: +60.9 kB (+4%) Total Size: 1.49 MB
ℹ️ View Unchanged
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for working on this @Addison-Stavlo!
@david-szabo97 good catch! That should be fixed now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! 🚢
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for working on this Addison! 👍
Co-authored-by: Nik Tsekouras <[email protected]>
Description
This PR updates the Template Part block's variations, area selection inputs, and default wrapper elements to be based off the areas defined in template-parts.php and passed into the editor store via settings. This allows these block variations and corresponding selection interfaces throughout the editors to share a single source of truth for the valid areas, their labels, descriptions, etc. Once a new area is defined in template-parts.php (or by the related filter), the corresponding block variation and selection options will automatically be present in the editor.
How has this been tested?
Smoke test the Template parts block variations in the post/page editor and the site editor, verify they continue to work as expected and that the expected wrapper element appears in both the editor and front-end.
Extra Credit Testing:
Add a new area variation and verify it appears and functions as expected throughout the editor. This can either be added directly to the
$default_area_definitions
in template-parts.php, or via thedefault_wp_template_part_areas
filter (for simplicity this can be done in template-parts.php above the correspondingapply_filters
call). Example:Load the editor and verify the new block variation is registered in the inserter and placeholder flow:
That the corresponding icons and description appear for a template part using that variation:
That it appears as an option in the 'area' selection in the block inspector:
That the 'convert to template part' flow from the block toolbar's ellipsis menu (site editor only) contains the new variation as an option:
And that the new template part uses its specified
defaultWrapperElement
(both in editor and on front-end) and that it appears as the default in the block inspector selection:Types of changes
Refactor existing functionality for truth consolidation and extensibility.
Checklist:
*.native.js
files for terms that need renaming or removal).