Help needed: DRY approach for populating blueprint item's options to frontend form select options

Hi all,

I am new to Grav but I am starting to love it. Nevertheless I am struggeling with all the options of solutions and I am stuck now. I searched through the existing items but did not find “my need” or at least I did not recognized it.

Can anyone please give me a hint/flow/advice how to do the following? I hope there is a DRY solution for this.

This part is working fine:
I have a number of pages using one common blueprint to add in the admin plugin content to the respective page header. The blueprint content is a list of items each consisting of multiple fields; also 2 fields of type list to hold some options (variants (e.g. xs/l/xl) and costs (e.g. single/monthly/yearly) of an item). Everything is rendered by twig very well (with a new template).

Here I need help, what to do best/easiest/DRYest:
For each item I like to have a frontend form to book this item in one variant and one cost option. The form should be on a separate page (i.e. selecting the item by clicking a href on the content page opens to a new page showing the form). I have the item pages rendered by twig and created one form in a new page frontmatter. But now

  • I need to provide some data/parameter when linking from the items page to the form page (I like to be DRY, so I think it would be best to have only one form page defining the common form). I read about the option to get the link parameter (https://discourse.getgrav.org/t/form-field-set-by-url-parameter/5136), but also read about issues with file uploads. Also I am struggling with safety of url parameters.
  • I need to populate the 2 select fields in the form for the selected item options (variants and costs). I read about the possibility to use data-options@ in combination with a custom made function in a new plugin or the theme php file. That could be a solution but how do I get the selected item data to populate the 2 selects in the form?

I am stuck a little bit with the combination, so any help is very appreciated.