Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you loop through a field on a custom engine in refinery cms

I'm creating a custom engine in refinery cms and I have a field called "PDF" that is a refinery resource field type.

Some entries in the engine will only have one pdf, while others will have multiple pdf's. Is there a way to do this without creating a bunch of extra fields that I don't need?

I'd prefer to loop through one pdf field rather than code extra fields into my engine - pdf_1:resource, pdf_2:resource, pdf_3:resource, pdf_4:resource, pdf_5:resource, etc.

How would you do this?

like image 797
Lee McAlilly Avatar asked Nov 13 '22 11:11

Lee McAlilly


1 Answers

To the best of my knowledge there isn't a built-in Refinery process for this. has_many would be the way I would approach the problem.

like image 74
John Hex Carter Avatar answered Nov 15 '22 07:11

John Hex Carter