-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Patterns: Allow orphaned template parts to appear in general category #52961
Conversation
Size Change: +45 B (0%) Total Size: 1.44 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.
This tested well for me:
- In trunk I added template parts to custom area and they displayed under category name of custom area
- I deleted the custom area and the General category count increased by the number of templates in the custom area, but clicking on that category did not display those template parts
- Checked out this branch and the orphaned template parts displayed under General
- The other template part categories continued to display correct child template parts
As suggested I do get a PHP warning from the core /wp-includes/blocks/template-part.php
file about an undefined array index after deleting the custom area, but this needs to be dealt with in a core patch as noted.
PR backporting the PHP fix is up in WordPress/wordpress-develop#4919 |
This changeset prevents an attempt to access an array via a key that doesn't exist. See WordPress/gutenberg#52961. Props aaronrobertshaw, glendaviesnz, mukesh27. Fixes #58920. Built from https://develop.svn.wordpress.org/trunk@56316 git-svn-id: http://core.svn.wordpress.org/trunk@55828 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This changeset prevents an attempt to access an array via a key that doesn't exist. See WordPress/gutenberg#52961. Props aaronrobertshaw, glendaviesnz, mukesh27. Fixes #58920. Built from https://develop.svn.wordpress.org/trunk@56316 git-svn-id: https://core.svn.wordpress.org/trunk@55828 1a063a9b-81f0-0310-95a4-ce76da25c4cd
I just cherry-picked this PR to the update/packages-wp-6-3-RC3 branch to get it included in the next release: ff9de80 |
Block library PHP changes will be pulled across in the package update: #53089 So it'll just overwrite WordPress/wordpress-develop#4919, assuming they're the same, which it looks like they are 👍🏻 |
Thanks, I'd forgotten about the block-library changes being different. That was explained on the trac ticket. Sorry for the confusion. |
All good. Just flagging in case the core patch did something different. |
* Patterns: Enable focus mode editing (#52427) * PreventDefault when isComposing is true. apply patch from t-hamano. (#52844) see: #52821 (comment) * List View: Ensure onDrop does not fire if there is no target (#52959) * I18N: Add missing Gettext wrapper on strings in Edit Post overview sidebar (#52971) * I18N: Add missing gettext wrapper * Add context to disambiguate 'Outline' that is commonly used on borders. * Footnotes: disable based on post type (#52934) * Footnotes: disable based on post type * Address feedback * Fix typo * Format: disable if block is not registered * Lock usesContext api * Use Symbol instead of Math.random * Patterns Browse Screen: Fix back button when switching between categories (#52964) * Patterns: Allow orphaned template parts to appear in general category (#52961) * Spacing presets: fix bug with select control adding undefined preset values (#53005) * Site Editor: Fix canvas mode sync with URL (#52996) * Check if spacing tool is defined before displaying controls. (#53008) * Check if spacing tool is defined before displaying controls. * Don't show sides if spacing type false * Improve consistency of the Post editor and Site editor Document actions (#52246) * Remove redundant shortcut button. * Fix focus and hover style and improve consistency. * Rename post document-title and improve CSS consistency. * Site Editor: Fix the typo in the title label map (#53071) * Fix patterns search crash: check for existence of defaultView before attempting to get styles (#52956) * backport paging bug fixes (#53091) --------- Co-authored-by: George Mamadashvili <georgemamadashvili@gmail.com> Co-authored-by: Hiroshi Urabe <mail@torounit.com> Co-authored-by: Andrew Serong <14988353+andrewserong@users.noreply.github.com> Co-authored-by: Pedro Mendonça <ped.gaspar@gmail.com> Co-authored-by: Ella <4710635+ellatrix@users.noreply.github.com> Co-authored-by: Aaron Robertshaw <60436221+aaronrobertshaw@users.noreply.github.com> Co-authored-by: Glen Davies <glendaviesnz@users.noreply.github.com> Co-authored-by: tellthemachines <tellthemachines@users.noreply.github.com> Co-authored-by: Andrea Fercia <a.fercia@gmail.com>
What?
Allows the display of a template part under the General category when it was assigned to a template part area that has since been removed.
Why?
Currently, the General category in the Pattern's page sidebar shows a count including these "orphaned" template parts. It is confusing when the template parts then don't show up in the patterns list.
How?
Updates the category filtering for the template parts. If the current category (template part area) is
uncategorized
a template part is considered in that category if it is explicitly assigned touncategorized
or is not assigned to a known template part area.Testing Instructions
Note: Without a core patch there will likely be a PHP warning thrown due to an unsafe attempt to access an array key
Screenshots or screencast