-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Shuffle content blocks when templateLock
is contentOnly
#44581
Comments
I suspect the details of this one (the icon, it's position in the toolbar) can be ironed out during implementation. Marking as needs dev and sending a ping to @WordPress/gutenberg-design for feedback on those details :) |
A very cool idea James! Actually I would like to see this also apply for template parts. A cycle through to test out various headers and footers or other template parts as I experiment with various designs while in the Site Editing mode. |
Agreed. "Replacing" a template part is still a cumbersome exp. |
I agree, that icon can work well to begin with.
Yeah that would be handy. I think the implementation would be slightly different though, so probably best to do that separately. Related: #44582 |
@jameskoster after I published that comment I realized that if there are a lot of patterns, reaching the ones at the end of the list could take a while, and picking random patterns could actually be better. |
Hi! I'm interested in giving this a shot! If I'm not mistaken, I think we should use the |
Oh yes, I agree it should be random. I think the icon still works though.
I'm not sure exactly how it works, but I believe blocks can be marked as having a |
I tried this approach out but I don't think it worked out nicely in practice. We have this Maybe we should use Moreover, currently a navigation block (and some other blocks) is not considered a |
@kevin940726 That's kind of where I came to when I thought about the problem in the past too. This was the past discussion and Matias' comment has links to related issues - #41397 (comment). They might be helpful for you to read through. I also just saw this issue which looks related - #41606. Using |
@talldan Thanks for the links! I was not aware of them. 👀 I tried the #30469 uses an approach to search for all available patterns locally and try to find a match. Unfortunately, that only works for simple blocks with no |
In this situation I think it'd be checking a container block's contents (i.e. group block) and comparing it to a pattern to see if it's a like for like swap. Would you be able to determine the block types that have the content role within a group and then check for the same block types in a pattern? |
The footer example would be strange, although if the footer pattern only contains a paragraph it might be visually appropriate. In practise, a footer will likely contain a site title, site tagline, navigation, or some other content block which should prohibit it from appearing. |
@kevin940726 wanted to check in here! What do you need to get unblocked? We're coming up on two weeks since you were jumping in so I wanted to ensure you had the support you needed to keep this work going :) |
@annezazu I'm working on a draft PR for a partial implementation so that we can discuss it further with a working branch. I'll polish it a bit and open it tomorrow ;) |
I opened #45618 for further discussion on one of the approaches mentioned here 🚶 |
I really like this. I wonder if it could even be extended to entire templates? E.g. if we have an About page and the user can shuffle the patterns to show variations? We could create a similar result like AI tools are exploring (like durable.co) but with a bit of curation from the theme/pattern builder. Is this something this is explored already? If we could define the patterns more precisely, for instance using categories, it could be a powerful experience for users. |
A key principle of the shuffle mechanic is that the constituent content blocks remain the same every time. In that light I feel it's best suited to smaller patterns. That's not to say your suggestion isn't a good one, it is! But it feels like something we can explore more as a part of the page / template creation flows. You may be interested in #42325 which is somewhat related. |
I am adding a comment which might not fit in here. Anyhow here goes. I can always add it to another issue as well. I believe a pattern block has been suggested in another issue. I find that an interesting idea. Perhaps adding a pattern should have it add as a pattern group option. Kind of like a new Group block option along with the various other options that currently exist for the Group block. More brainstorming. This means a Pattern is a kind of special Group block which currently exist in the pattern categories. Actually one more thing came up while I was doing the latest call for FSE testing. |
Marking this as a backlog item at this point with this work being impacted by larger wp:pattern efforts #48458 yet being lower priority in comparison. |
The full scope of pattern shuffling will likely be identified during #27575. |
When a container has
templateLock
iscontentOnly
applied, it would be neat to offer a way to cycle between patterns that utilise the same 'content' blocks.Here's a demo:
Note how the layout / colors etc change, but the content blocks (heading, button, image) remain consistent.
The text was updated successfully, but these errors were encountered: