FormWidget getSaveValue format


I have my FormWidget inside a repeater. Now I need to make a right format out of the $value inside getSaveValue.

My $value looks now like this:

array:3 [▼ 0 => array:1 [▼ 1 => "1" ] 1 => array:1 [▼ 2 => "1" ] 2 => array:1 [▼ 1 => "1" ] ] 

I assume, that when I have three repeater items, the inside arrays are put in each of these repeater items, but what happens is, that the first repeater item gets all of this arrays saved and the other two item are not set.

What should the save value look like for a repeater jsonable?

After thinking about it, I came to this conclusion:

Every time I add a new repeater item with my FormWidget inside, probably a new FormWidget Class instance gets created. Then, when saving, the last of this instances probably overwrites all instances before. But I’m not sure about that.

My solution will be:
Create a new pivot table with model id and repeater FormWidget data for each main plugin item. I won’t save my FormWidget data in the main model repeater jsonable DB column, but inside the pivot table. I’m not sure, if that will work, but I will try.

If somebody has a better idea, please…