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

Patterns: Create a pattern in a similar way to how we create a Reusable block. #31298

Closed
paaljoachim opened this issue Apr 28, 2021 · 13 comments
Closed
Labels
[Feature] Patterns A collection of blocks that can be synced (previously reusable blocks) or unsynced Needs Design Feedback Needs general design feedback. [Type] Enhancement A suggestion for improvement.

Comments

@paaljoachim
Copy link
Contributor

What problem does this address?

At current there is no user interface to create a pattern. Let's change that.

What is your proposed solution?

Similar to how we add blocks to become a Reusable block it would be helpful to add blocks to become Pattern blocks.

Patterns-Add-to-Pattern-blocks

@paaljoachim paaljoachim added [Feature] Patterns A collection of blocks that can be synced (previously reusable blocks) or unsynced [Type] Enhancement A suggestion for improvement. labels Apr 28, 2021
@mtias
Copy link
Member

mtias commented Apr 30, 2021

We used to allow this briefly and removed it because it's confusing. Even in that dialogue it's not clear to me when I should choose one option over the other. A project to allow user editable patterns could be worthwhile but it needs a much broader scope and proposal, as it'd be a subtype of wp_block.

@mtias mtias closed this as completed Apr 30, 2021
@paaljoachim
Copy link
Contributor Author

paaljoachim commented Apr 30, 2021

I am wondering if we should do something like this:

Add to Reusable blocks
Add a global connected block

Add to Pattern blocks
Add an independent pattern block.

As it gives a short explanation of what each is. It would use the current method, and it can be an easy way to choose to use a global connected block or an independent block. It would give a quick access to creating both types of blocks directly in Gutenberg.

@paaljoachim
Copy link
Contributor Author

paaljoachim commented May 1, 2021

@mtias

I am thinking something similar to this:
Add-to-Reusable-Pattern-blocks

A one liner that Reusable blocks are still connected with the original block.
That Pattern blocks are disconnected from original block.

@kjellr @melchoyce

Associated:
Patterns: Manage Patterns similar to Reusable blocks.
#31367

Reusable blocks: Convert a Reusable block to a pattern.
#31296

@mtias
Copy link
Member

mtias commented May 3, 2021

Could be, or perhaps we need to use a modal where we can offer more context on what each option allows. In any case it needs a more in depth look to all the implications.

@paaljoachim paaljoachim reopened this May 28, 2021
@paaljoachim
Copy link
Contributor Author

I reopened the issue as it would be helpful to save blocks to a Pattern block.

@JosVelasco
Copy link

Perhaps make the option only available from the FSE editor. Something like an advanced option.

@JosVelasco
Copy link

JosVelasco commented May 29, 2021

There is already a plugin that converts reusable blocks to patterns and it works good. Reusable Blocks Extended: https://wordpress.org/plugins/reusable-blocks-extended/

Since there is a concern about generating confusion in the posts editor we could polish this plugin. Instead of "convert to reusable block" we could add the option "save as pattern" making a copy of the reusable block and listing it in /wp-admin/edit.php?post_type=wp_block

There could be a filter at the top of the list, please see my attachment.

reusable-block-pattern

@paaljoachim
Copy link
Contributor Author

paaljoachim commented May 31, 2021

Hi @JosVelasco

That is a very good idea!

Adding the option to the Reusable blocks manage screen as you are showing is one good way of handling it.
As it would keep it out of the Gutenberg layout area for now and instead we just give the option in the manage screen.

One thing that comes to mind. To create a pattern one would first need to save it as a Reusable block and then -> convert/save it as a pattern. I do look forward to having a method to click multiple blocks and then save these as a Reusable block or as a Pattern directly through the ellipsis /3 dot drop down.

@paaljoachim paaljoachim added the Needs Design Feedback Needs general design feedback. label May 31, 2021
@paaljoachim paaljoachim changed the title Patterns: Create a pattern in a similar way to have we create a Reusable block. Patterns: Create a pattern in a similar way to how we create a Reusable block. May 31, 2021
@mtias
Copy link
Member

mtias commented Jun 22, 2021

Also related: #32682. There's a proposed flow there for creating patterns as part of a design library.

@ecations
Copy link

This would indeed be very helpful. The way we create reusable blocks is really easy and intuitive. But I only need to reuse the structures (and not the content) so I'm looking at block patterns. And it seems to be a lot more involved to create those compared to reusable blocks.

@mtias
Copy link
Member

mtias commented Jun 27, 2023

This is done now!

@mtias mtias closed this as completed Jun 27, 2023
@ecations
Copy link

That's great news! Where can we find more info about this feature?

@paaljoachim
Copy link
Contributor Author

Hi @ecations

Here is a PR which shows how it will work:
#51144

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Patterns A collection of blocks that can be synced (previously reusable blocks) or unsynced Needs Design Feedback Needs general design feedback. [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

No branches or pull requests

4 participants