WordPress / gutenberg

The Block Editor project for WordPress and beyond. Plugin is available from the official repository.
https://wordpress.org/gutenberg/
Other
10.37k stars 4.15k forks source link

Add block patterns to the Widgets editors #26170

Open bph opened 3 years ago

bph commented 3 years ago

It seems with the omission of the widget title property of widgets, and the replacement of the current core widgets with blocks, that don't have titles, end users will need to use multiple steps to recreate their sidebar units, combining core/block like latest posts or calendar with a heading block (=title) to display in the sidebar.

Now that every block has its widget wrapper this seems to only work well with a group block containing heading block + paragraph block.

With block patterns available via the Inserter, themes and plugins would be able to provide the widgets as a block patterns and help their users with this.

annezazu commented 3 years ago

@mapk wanted to flag this for you for a design perspective as this seems like a major UX flow to get right.

mapk commented 3 years ago

Thanks for the ping, @annezazu! Overall moving to blocks and helping users become accustomed with blocks is our goal here.

Block patterns can help as @bph points out when trying to combine blocks, or even just trying to establish a nice layout. I'm all for this. I remember @justintadlock pointing this out too.

Currently, we've just merged in Reusable blocks. Let's get a Patterns tab in there now too.

Screen Shot 2020-10-19 at 1 36 12 PM

noisysocks commented 3 years ago

If this is easy to implement then let's do it. If not, we could consider leaving it out of v1 of the widgets editor.

critterverse commented 3 years ago

Hi all! I just wanted to add to this discussion that I think introducing patterns would be a great addition to the widget editors now that we’re looking ahead towards further enhancements for the block-based editing experience.

It would be really helpful for themes to be able to supply their own widgets patterns, which would help resolve some of the hiccups we’ve seen with the way certain themes like Twenty Twenty-One handle the flow of content within a widget area. Design contributors could also potentially submit universal widget patterns to the new Pattern Directory. Ideally, the directory could showcase patterns that mirror “traditional” widget layouts (a grouped lockup with a widget and title above) as well as other interesting layouts that are newly possible with blocks.

Maybe there could even be a new category introduced in the Pattern Directory for widgets, but I would defer to others who have been more closely involved with the development of the directory on how we could best incorporate widget patterns into the existing structure there.

An early sketch of how the inserter might look to help get the discussion going:

widget-patterns

Note that the "tip" section typically appears at the bottom of the inserter but could potentially be made more prominent somehow in order to help direct users towards the Pattern tab. Also note that Reusable blocks may be introduced into the widgets editors as well (https://github.com/WordPress/gutenberg/issues/32952), which would introduce a third tab alongside "Blocks" and "Patterns."

kjellr commented 3 years ago

Maybe there could even be a new category introduced in the Pattern Directory for widgets, but I would defer to others who have been more closely involved with the development of the directory on how we could best incorporate widget patterns into the existing structure there.

Interesting suggestion. If we did this, I do think a separate category would make sense  — many (the majority?) of patterns in the directory will likely look weird in a sidebar for example, so I like the idea of having a dedicated category for sidebar-optimized widgets.

shaunandrews commented 3 years ago

Having patterns available from the new widget screen seems like a big bonus for using blocks; I'd love to see it happen.

I'm not entirely sure about adding a "Widgets" category to the directory, though. Instead I think it might make more sense to add multiple categories like "Sidebar" and "Footer." Then, we can use a "Widget" tag (and Block Scope) to help provide context to the patterns in those categories.

critterverse commented 3 years ago

Instead I think it might make more sense to add multiple categories like "Sidebar" and "Footer." Then, we can use a "Widget" tag (and Block Scope) to help provide context to the patterns in those categories.

This makes much more sense. Thanks for weighing in @shaunandrews and @kjellr!

draganescu commented 3 years ago

So effectively "enabling" patterns is just adding the

array( 
            '__experimentalBlockPatterns'          => WP_Block_Patterns_Registry::get_instance()->get_all_registered(),
            '__experimentalBlockPatternCategories' => WP_Block_Pattern_Categories_Registry::get_instance()->get_all_registered(),
        )

configuration to the initialization of the widgets editor.

However we don't support entity based blocks, so patterns such as the ones in the "Query" category won't work. So the main task here is to see whats up with the reusable and FSE blocks keeping them from working, see #32952.

ndiego commented 2 years ago

Is there any active work being done on this? Patterns really need to be available from the block based widgets screen.

noisysocks commented 2 years ago

@draganescu is correct. It's easy to fix this but we're blocked by #32952 which is more involved.

Just noting that we also will need to implement this for the inserter in the widgets customizer section.

JTorresConsulta commented 1 year ago

What's going on 6.1 ?
Why can't I add reusable patterns to widgets blocks !?

JTorresConsulta commented 1 year ago

At this moment Wordpress has become a frustration factory

You cannot use widgets in the block editor You also can't use blocks in the widget editor

LOL

Julianoe commented 5 months ago

This is getting ridiculous. Blocks are everywhere in the WordPress admin now. Latest update even introduced a "Patterns" link (at last!) in the admin menu to make it a more obvious tool to use for end-users... but widgets still can't use patterns..

On a UX perspective this is misleading. People (clients, users) who learned to use the block editor are now wondering why they can't use this patterns tool which in the Widgets UI which looks exactly the same as the Posts/Pages editor UI...

annezazu commented 5 months ago

Following up here after getting this recent notification. Thanks all for continuing to chime in. I wanted to recap where things stands as of today:

I've opened a developer blog topic to help get the word out to classic theme authors for now https://github.com/WordPress/developer-blog-content/discussions/254

If anyone following this work wants to try out a PR to allow patterns without certain blocks to be used in the widgets area, please jump in!