Getting an image field to work within a block repeater #2358
Unanswered
adam-jones-net
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I think I'm very close to having this working but just need a bit of guidance. I'm using twill 2.x and I've read the discussion here on doing this as well as reviewing the default-configuration.md file, but I'm afraid that I'm still not clear on how this works, and there doesn't seem to be anything in the official Twill docs about it.
Basically I have a working repeater field in a block element. That was setup in twill.php like this:
... and it works fine. There is a /blocks/rate.blade.php file and the fields defined in that work fine, saving to my module's table.
However I now need to add a single image field to the repeater inside this block.
I added that into the /blocks/rate.blade.php file as follows:
Update: I've since got the data saving to the custom json text field in my database by adding the image field to the public $mediasParams = of the models file. So it now includes...
The only problem is getting the repeater to show the image when the edited page is reloaded. I'm sure this must be something in the repository file but not sure what.
The repeater includes the following to process the data to/from json
and what i see in the returned data on the loading of the edit page in twill is this...
So I assume the format of the returned data for this field is wrong and twill doesn't find what it needs to realise that it needs to pre-populate the image field. It seems like I'm at the final step of this and just need some guidance on how to alter this returned array.
@ifox | @haringsrob , is there anything you can suggest here ? I can't find hardly anything in the forum on getting media fields working in json repeaters to help me. :|
Beta Was this translation helpful? Give feedback.
All reactions