Adding Repeater Fields to a Block

Inside a block, repeaters can be used too.

  • Create a container block file, using a repeater form field:

File:

views/twill/blocks/accordion.blade.php

1@twillBlockTitle('Accordion')
2...
3<x-twill::repeater type="accordion_item"/>

You can add other fields before or after your repeater, or even multiple repeaters to the same block.

  • Create an item block, the one that will be repeated inside the container block

File:

views/twill/repeaters/accordion_item.blade.php

1@twillRepeaterTitle('Accordion item')
2@twillRepeaterMax('10') // Optional
3 
4<x-twill::input
5 name="header"
6 label="Header"
7/>
8 
9<x-twill::input
10 type="textarea"
11 name="description"
12 label="description"
13 :rows="4"
14/>