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

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

Closed
paaljoachim opened this issue Apr 28, 2021 · 5 comments
Closed

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

paaljoachim opened this issue Apr 28, 2021 · 5 comments
Labels
[Feature] Patterns A collection of blocks that can be synced (previously reusable blocks) or unsynced [Feature] Synced Patterns Related to synced patterns (formerly reusable blocks) [Type] Enhancement A suggestion for improvement.

Comments

@paaljoachim
Copy link
Contributor

What problem does this address?

An example is Learn that uses Reusable block "templates". Before using the "template" one needs to remember to convert it to regular blocks or else one might end up overwriting the Reusable block.

What is your proposed solution?

Having a simple way to convert a Reusable block to a pattern. In the 3 dot contextual options drop down. Second option from the bottom.

Reusable-block-Convert-to-Pattern-blocks

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

mtias commented Apr 30, 2021

This would be too confusing for users to understand the differences.

@paaljoachim
Copy link
Contributor Author

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.

It is important to have both approaches available because of different use cases.
There are situations where one needs a kind of template/guide for a user to fill in. This would be perfect to use with a Pattern, and would not fit in with a Reusable block.

@paaljoachim
Copy link
Contributor Author

(Same comment I made to: #31298 )

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 @shaunandrews

The purpose
As the Patterns Directory is introduced it will also be nice for people to create their own patterns. To introduce Patterns into the Gutenberg interface using the Reusable block method. The very first iteration of giving the user the opportunity to easily create patterns that are added to the Pattern inserter panel. Of course this will be to be iterated upon. To add additional features.

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

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

@davidwebca
Copy link

davidwebca commented May 1, 2021

Even I, a well seasoned WordPress developper, need to check out the difference between all the different block saving features, namely the full-site templates, the block patterns and reusable blocks.

Reusable blocks - Saves one or multiple already registered blocks and its settings in the database and allows the user to put it in multiple pages with a single source of truth. Changes are replicated everywhere this block is displayed, but are "detachable" once they're added to content.

Block patterns - Allows registering one or multiple blocks with information and settings pre-filled by using code. There is no single source of truth and is mostly used to pre-populate multiple blocks at once.

Full-site editing templates - These will be another beast altogether, but still very much tied to all of this. Theme developers will create html template files to either render blocks or specify areas that users will be able to insert blocks into, such as navigation, header and footer. Mostly works through Gutenberg's parsing of special html comments.

--

Apologies for the summary, I needed it for myself and clearing my head on the subject at hand. That being said, I think block patterns and reusable blocks should be the same thing. I don't really get why they're a whole separately named thing when the only technical difference between them is the single source of truth. That "single source of truth" could simply be an option to check named "link to master" or something along those lines. One reusable-block-pattern hybrid could reference to another one with the "<!--wp-block" block type that already exists, but would probably just need to check for circular references to avoid infinite loops of inclusions.

@paaljoachim paaljoachim changed the title Reusable blocks: Convert a Reusable block to a pattern. Add to Pattern blocks May 28, 2021
@paaljoachim paaljoachim changed the title Add to Pattern blocks Reusable blocks: Convert to Pattern block May 28, 2021
@paaljoachim paaljoachim changed the title Reusable blocks: Convert to Pattern block Reusable blocks: Convert a Reusable block to a pattern block May 28, 2021
@mtias
Copy link
Member

mtias commented Jun 29, 2023

Done in #51144.

@mtias mtias closed this as completed Jun 29, 2023
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 [Feature] Synced Patterns Related to synced patterns (formerly reusable blocks) [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

No branches or pull requests

3 participants