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

Consider template blocks or semi-global shared blocks #6297

Closed
ZebulanStanphill opened this issue Apr 19, 2018 · 1 comment
Closed

Consider template blocks or semi-global shared blocks #6297

ZebulanStanphill opened this issue Apr 19, 2018 · 1 comment
Labels
[Feature] Synced Patterns Related to synced patterns (formerly reusable blocks) [Feature] Templates API Related to API powering block template functionality in the Site Editor

Comments

@ZebulanStanphill
Copy link
Member

ZebulanStanphill commented Apr 19, 2018

Issue Overview

Currently, a shared block is identical to every other instance of that shared block. This is useful for things like footers. However, there are cases where you want to have the same style of something, but with different content in every place it is used. The proposal for "block templates" in #3588 partially covers this, but that is a list of blocks that is used when initially creating a page and I am guessing you would not be able to have multiple templates in a single instance of the editor.

Multiple page builder plugins (including Beaver Builder, Divi, and Elementor) include some form of template system for their modules/widgets, where you can drop in a template and then edit it to fit the particular page. The templates are sometimes singular modules, but other times include rows/sections or even multiple rows/sections, almost becoming a list of blocks similar to the proposal for "block templates" in #3588.

In the context of Gutenberg, sections, rows, columns, and the stuff inside columns are all just blocks, so a template block system could work by simply allowing for a block to be saved as a template that could be inserted from the block inserter. Of course, editing these template blocks would have to be different than with shared blocks, because once a template block is inserted, the resulting block has no idea it came from a template, so editing or removing a template block would have to be done through some other UI. Most page builder plugins have a library of templates that is used to manage templates.

And then there are cases where you have something that is a sort of hybrid template/shared block. Some properties are global, but others are not. Divi has a feature called Selective Sync that allows you to have global modules with your choice of which features are global and which are local to each instance of the module.
https://www.elegantthemes.com/documentation/divi/selective-sync/

Now, some cases of where this would be used (page titles that are different from the <title> title) will be covered when Gutenberg gets the ability to modify areas outside of post_content. The proposed "block templates" will cover other situations. However, I think there will still be cases where a shared block with some properties made local instead of global would be quite useful.

Side note: Given their current proposed functionality, the "block templates" should probably be called "page block templates" instead since they are more like or perhaps even the replacement for the page templates that currently exist in WordPress, while the "template blocks" idea refers to something that is inserted from the block inserter in an instance of the editor.)

So as far as I can see, the best approaches to this issue would be to extend the shared blocks system to support having some properties be made local (preferably chosen by the user).

Even if the "selective sync" feature is deemed unnecessary, having template blocks would still be a nice feature, so that would have to be implemented somehow, and I can see 3 ways of doing it:

  • Extend the shared blocks system to include blocks that are not "global".
  • Add a new template blocks system that is separate from shared blocks.
  • Extend the "block templates" system proposed in Proposal for Block Templates #3588 to allow for templates that do not take up the entirety of the content.

As you can see, this is a bit of a complicated subject. The concepts of shared blocks, template blocks, "block templates"/page templates all start to blend into each other... especially if you include the "selective sync" functionality. I am not entirely sure where one should end and the other should begin.

It should be noted that this should not be confused with the concept of "global block settings", which would be settings that apply to every instance of a block, and possibly also the default settings of a block.

Related Issues and/or PRs

@danielbachhuber danielbachhuber added [Feature] Templates API Related to API powering block template functionality in the Site Editor [Feature] Synced Patterns Related to synced patterns (formerly reusable blocks) labels Jun 27, 2018
@danielbachhuber
Copy link
Member

Hi @SuperGeniusZeb,

Thanks for the suggestion! I've filed this away in the Ideas project for future consideration. At this point in the Gutenberg development cycle, we're focusing on finishing the remaining features and then switching to bug fixing / polish.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Synced Patterns Related to synced patterns (formerly reusable blocks) [Feature] Templates API Related to API powering block template functionality in the Site Editor
Projects
None yet
Development

No branches or pull requests

2 participants