I’m using a repeater to generate some text boxes (they have several sub-fields, for example title, subtitle, text, related link, etc). I want to then link each image in the media uploader to a unique text box and display both using a custom gallery code (the text box will appear this next to the image). I’m doing this to support more advanced cases than the media uploader description/caption/alt text could handle.
I got this working, but the problem is that the IDs that ACF generates for the different rows in a repeater are not unique, and always start from 0 depending on the set order. You can see how this is a problem, because if I reorder the rows at a later point, the associations will get all mixed up.
I did more digging and I think I might have made this work in a different way, by adding an Image subfield for each row and thus creating the relationship in the repeater, instead of the other way around.
In the gallery code, I can the use get_field to get all the rows and for every images search for a row which has a linked image ID matching the current one.
I’d still be curious to know if it could also be done the other way around.