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.
Hello, Sadly I don't come with a solution, but I'm in similiar pickle- Did You, by any chance find a solution, or workaround to this?
Unfortunately no, I wasn't able to find a solution.
However this is something currently being worked on https://github.com/octobercms/october/pull/4325. It just has low priority, so if you really need it, feel free to work on it yourself or ask them if they would accept a bounty to prioritize this higher.
1-3 of 3