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

Ensure Header & Footer patterns use the Pattern Directory API #46017

Closed
2 tasks done
annezazu opened this issue Nov 23, 2022 · 15 comments · Fixed by #46450
Closed
2 tasks done

Ensure Header & Footer patterns use the Pattern Directory API #46017

annezazu opened this issue Nov 23, 2022 · 15 comments · Fixed by #46450
Assignees
Labels
[Feature] Pattern Directory The Pattern Directory, a place to find patterns [Feature] Patterns A collection of blocks that can be synced (previously reusable blocks) or unsynced [Type] Task Issues or PRs that have been broken down into an individual action to take

Comments

@annezazu
Copy link
Contributor

annezazu commented Nov 23, 2022

While we have an in between solution in place for now with the bundled header & footer patterns #44843 (comment), the following still needs to be done to close out efforts here. This is a quick, new issue to ensure that work continues forward.

Desired outcome:

Header and Footer patterns are in the pattern directory and pulled in from there rather than being bundled. The bundling was a temporary measure that we need to follow up on.

Next steps:

  • @beafialho to submit patterns for header & footer to the pattern directory directly.
  • @ntsekouras (if you're able to help with this) to then load the submitted patterns into the editor once the patterns are submitted.

For the latter, want to note the following from @ryelle around how to do so -- "either with a new API request with specific slugs, or by adding these to the featured category to auto-load them on all sites"

@annezazu annezazu added [Type] Task Issues or PRs that have been broken down into an individual action to take [Feature] Patterns A collection of blocks that can be synced (previously reusable blocks) or unsynced [Feature] Pattern Directory The Pattern Directory, a place to find patterns labels Nov 23, 2022
@annezazu
Copy link
Contributor Author

@beafialho let me know the patterns are submitted and pending approval! Going to cross that off for now.

@ntsekouras
Copy link
Contributor

ntsekouras commented Nov 29, 2022

For the latter, want to note the following from @ryelle around how to do so -- "either with a new API request with specific slugs, or by adding these to the featured category to auto-load them on all sites"

Should we consider them core patterns or they are something different? If they can be considered core we could just add the keyword(11) in pattern directory and in theory everything should just work. If we want them to be featured that would also just need the change in pattern directory. In these both scenarios I'd need to check if we can remove the existing registration in GB now, but that's a different matter.

If we want them completely separate I can implement the function to make a new request.

@ryelle
Copy link
Contributor

ryelle commented Nov 29, 2022

I'm happy to make those changes in the pattern directory, just let me know which term (the hidden one, core or public-facing, featured) is decided :)

@annezazu
Copy link
Contributor Author

annezazu commented Nov 29, 2022

AFAIK these patterns should be listed as "featured" since they are meant for use on all sites and are curated by WPORG (partially based on this convo WordPress/pattern-directory#542 ) @jasmussen can you confirm this? I want to ensure I have this absolutely correct.

@jasmussen
Copy link
Contributor

I could be missing a few beats here, so forgive me if I'm restating things already noted, but my understanding is that this needs to consider the new structure outlined in #44501. Which is a meta-split into two major categories, Featured and Community. Featured are all from the WP.org user, Community is everything else. Both of those meta-categories are sub-categorized into the noted buckets, and I would imagine the "Header" and "Footer" categories being used for these.

@ntsekouras
Copy link
Contributor

Let's try to clarify the end goal here, because some of the mentioned things by me are technicalities.

  1. These patterns currently have only header, footer categories and what else. Do we need them to be shown in featured pattern category as well?
  2. Do we want them to be loaded by all sites? If yes we can just treat them as core patterns(technicality).

Which is a meta-split into two major categories, Featured and Community. Featured are all from the WP.org user, Community is everything else.

Just curious how this is going to affect Gutenberg. In my mind we would still have the pattern categories in the inserter and where else we use them, but we might use that meta(community/featured) to maybe sort patterns? Is it something different?

@jasmussen
Copy link
Contributor

Just curious how this is going to affect Gutenberg. In my mind we would still have the pattern categories in the inserter and where else we use them, but we might use that meta(community/featured) to maybe sort patterns? Is it something different?

To clarify, Community and Featured tabs are both available in the pattern directory. But only patterns from the Featured tab show up in the pattern explorer (#44611).

There's a doodle of how those tabs could look in WordPress/pattern-directory#395 (comment) — it's not a final design by any means, I would hope we can make it much more compact and simple. But hopefully it shows the split.

@ntsekouras
Copy link
Contributor

Sorry but still it's not 100% clear to me what we want for Gutenberg. If I understand correctly the meta community/featured is something that Pattern directory will implement first and it will dictate some requests when we connect it with Gutenberg, but not right now.

I think the confusion comes with having a featured pattern category and a meta with the same name 😄 .

The goal for this issue is to simply fetch these header and footer patterns from Pattern Directory and not bundle them with files as we do now.

So, right now these patterns don't have the featured pattern category, so I think adding the core keyword to them would be enough to show them to all sites and in the same pattern categories that are shown right now. Just noting that in _load_remote_block_patterns was introduced in core in 5.8, so I guess every such pattern should be valid back to that version too, no?(that's for @ryelle 😄 )

@jasmussen
Copy link
Contributor

I think the confusion comes with having a featured pattern category and a meta with the same name 😄 .

Right, sorry for the detour, yes! Mainly I wanted to be sure that those bundled header and footer patterns are only sourced from the wp.org user, so we don't suddenly have thousands of options to scroll through in the "Replace" flow 😅

@ryelle
Copy link
Contributor

ryelle commented Nov 30, 2022

Just noting that in _load_remote_block_patterns was introduced in core in 5.8, so I guess every such pattern should be valid back to that version too, no?

By default yes, any patterns tagged core would be loaded on 5.8, but if we want to restrict them to 6.1+ (or 6.0+, etc) we can add a version meta value - it needs a wporg sandbox though, so just let me know of the patterns & version values and I can add it.

@ntsekouras
Copy link
Contributor

ntsekouras commented Dec 2, 2022

By default yes, any patterns tagged core would be loaded on 5.8, but if we want to restrict them to 6.1+ (or 6.0+, etc) we can add a version meta value

@ryelle can we tag them as core add them with 6.1 version for now, as it's when they were first introduced?

@ntsekouras
Copy link
Contributor

@ryelle when you find some time and update the patterns, please share, in order to open a PR to handle the GB side. Thanks!

@github-actions github-actions bot added the [Status] In Progress Tracking issues with work in progress label Dec 10, 2022
@annezazu
Copy link
Contributor Author

annezazu commented Jan 5, 2023

Noting that there's a PR in place to remove the bundled patterns & load them appropriately from the pattern directory #46450 This is currently on hold though until the patterns listed here are recategorized and a problem with patterns with the navigation block is resolved.

@ntsekouras
Copy link
Contributor

With the current implementation of the registration of patterns and the change of the above patterns to be core ones, we always end up with them overriding the bundled ones.

That means that if we don't find a solution for WordPress/pattern-directory#545 in time for6.2, we should remove them as core patterns in PD, and keep the GB bundled ones.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Pattern Directory The Pattern Directory, a place to find patterns [Feature] Patterns A collection of blocks that can be synced (previously reusable blocks) or unsynced [Type] Task Issues or PRs that have been broken down into an individual action to take
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants