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

Search and/or group patterns by block #33

Open
tellyworth opened this issue Jan 18, 2021 · 4 comments
Open

Search and/or group patterns by block #33

tellyworth opened this issue Jan 18, 2021 · 4 comments
Labels
[Component] Pattern Creator Anything related to the pattern front end editor or preview [Component] Pattern Directory API The pattern API on WordPress.org, and/or the CPT endpoint [Status] Needs Design [Type] Enhancement New feature or request

Comments

@tellyworth
Copy link

It's likely that the editor UI will have a flow where users could discover patterns that contain a particular block.

As a hypothetical example, if I'm adding a Buy Now button to content, it should be easy for me to discover that my e-commerce plugin already has some patterns for product layouts that contain the Buy Now button, to save me doing it all manually.

That suggests some things would be required on the back end:

  • A way to search both local and remote patterns for an exact match by block slug.
  • Possibly a way to retrieve all local patterns grouped by block (if for example the inserter UI was to display blocks and patterns side by side).

This is still a feature idea in progress so it's not clear exactly how it might pan out and what the final flow and requirements might be.

@tellyworth tellyworth added [Component] Pattern Directory API The pattern API on WordPress.org, and/or the CPT endpoint [Type] Enhancement New feature or request labels Jan 18, 2021
@mtias
Copy link
Member

mtias commented Feb 10, 2021

Related WordPress/gutenberg#27575.

@ryelle ryelle modified the milestone: Initial Launch Mar 30, 2021
@ryelle ryelle added the [Type] Discussion Proposed idea, needs input from others before actionable label Mar 30, 2021
@ryelle
Copy link
Contributor

ryelle commented Apr 21, 2021

Block patterns can have a blockTypes property, which identifies blocks that can be converted into this pattern. For example, the paragraph block:

Screen Shot 2021-04-21 at 2 31 17 PM

We should add some (optional) way of flagging patterns as related to block types, and on the validation side, make sure the pattern can be transformed from the chosen block. It seems like patterns can be related to more than one block type, but I think in practice, it's usually just one.

The API & proxy API will also need to be updated to allow a "blockTypes" parameter for fetching patterns.

@ryelle
Copy link
Contributor

ryelle commented Oct 20, 2021

There is a PR on the Gutenberg side to use the blockTypes meta value when registering patterns: WordPress/gutenberg#32113

We still need to create a flow for setting the blockType value when creating a pattern.

@ryelle ryelle added this to To do (for launch) in Pattern Creation [i1] Nov 10, 2021
@ryelle ryelle removed this from the Pattern Creation milestone Dec 1, 2021
@ryelle ryelle removed this from To do (for launch) in Pattern Creation [i1] Dec 1, 2021
@ryelle ryelle added [Status] Blocked Progress is blocked, and needs team input to move forward [Status] Needs Design and removed [Type] Discussion Proposed idea, needs input from others before actionable [Status] Blocked Progress is blocked, and needs team input to move forward labels Dec 1, 2021
@ryelle
Copy link
Contributor

ryelle commented Dec 1, 2021

We can set blockTypes for a pattern, and that will pass through the API to the editor to make it work (once WordPress/gutenberg#32113 is merged).

The unanswered question here is how that should work (in the UI) when creating a pattern. Since we still don't have a design here, and the gutenberg API has no traction (so it won't make 5.9), I've pulled this out of the pattern creation v1 milestone. We can revisit it post-beta or post-launch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Component] Pattern Creator Anything related to the pattern front end editor or preview [Component] Pattern Directory API The pattern API on WordPress.org, and/or the CPT endpoint [Status] Needs Design [Type] Enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants