I am trying to develop my first plugin for October CMS and in one part I want the user to select multiple images from the media finder. Since this isn't implemented natively, I am using repeater to add the images one at a time. I have the following in my model:
public $attachMany = [
'images' => ['System\Models\File', 'order' => 'sort_order'],
];
And in my fields.yaml:
images:
type: repeater
titleFrom: title_when_collapsed
tab: myplugin::lang.tabs.images
form:
fields:
images:
label: myplugin::lang.modeldata.images
type: mediafinder
mode: image
imageHeight: 150
imageWidth: 250
When I go to my plugin page in the backend, I can choose multiple images, however when I save the post, it doesn't save the images that I select. The media finder appears blank again after refreshing.
Is this more or less the right way to do it, or should I be using something like a pivot table to store the references to the image locations and post ids? If so, any link on how to do that would be a great help.