Select an another block in a block?
Hi everyone,
I have a function to create a new block with name "Columns block". With this block, user can create a new content row with multiple column. And after that, user can select a specific block (it will dynamic with all block already had in system) that they want to show in column.
Can Twill already support this function?
11 Replies
Hi @huuvien17 nested blocks (as in, putting a block_editor field inside a block form) are supported in twill 3, but I think you're asking for something else, I'm not sure.
Hi @ifox.dev thanks for your reply. I put this question because I am using Twill v2. So let's me try to use v3. If not I will ask you later. 🤗
In twill 2 an option is to use a repeater with a conditional field
but it requires a lot of duplication if you want all your blocks to be also available in a repeater form
that's why twill 3 introduced nested blocks
I already used repeater in Twill v2 but I not same with my expectation. Repeater will repeat a specific a static block/content. But in my case, I need a dynamic for some selecting
that's why I said with a conditional field. It would be a select labelled "block type" for example, and depending on the value of that select you would show the appropriate fields
Sorry, I don't understand this labelled "block type" you are mentionning. Is it a field of the repeater of v2?
That was just an example select field label you would use to let the user select one of the block type you want them to be able to put in that column
but let's step back, i think we're talking about different things
do you want users to be able to create a block from scratch in those columns, or do you want them to select a block with its content already created in another record?
In my case, I need create a new block (maybe it have 3 columns in layouts). User can drag/drop it in block editor window. And after that, user can drag/drop an another block (example select 1 text block for first column, and 1 image block for second column...etc) for each column in the dropped block that I mentioned above.
@ifox.dev In my case, it look like that. From 0:22 -> 01:00
https://youtu.be/xiOzEz0tJcY?t=22
Jamie Marsland
YouTube
Awesome Columns and Grids using the WordPress Block Editor and Gute...
Columns and Grids are the cornerstone of web design but the Gutenberg Block Editor Column Block is somewhat limited.
That's where the Gutenberg Pro plugin comes in. Gutenberg Pro adds a whole bunch of extra options to the core Columns Block to make it a really poweful page layout tool.
Here's a link to Gutenberg Pro (free 14 day trial availa...
ok yeah so definitely nested block editors in Twill 3 solve for that. what I was saying is that on Twill 2 you can artificially do this using a column repeater inside a block. The field in the column repeater would be something like
- column content type (select): text/image/video/etc...
- if the column content type is text, show the fields you need for a text block
- if the column content type is image, show the fields you need for an image block
- and so on
https://twill.io/docs/form-fields/conditional-fields.html
Yay, it is so amazing!! Thanks for your time.
I will upgrade for v3. Thank you again 🤗