Hello,
As in a few archived topic I have read, people would like to dynamically create options in frontmatter :
The first topic has no answer, and the second topic is more specific about the possible solution, but as noobs we need help on how to build such a function.
Here’s my situation :
- I have a form in wich a series of checkboxes correspond to a bunch of things.
- These things are by the way existing as a collection of pages as children of an other page.
- Instead of manually adding each field in my form, corresponding to a thing, I would like to retrieve the
page.collection()
to automatically build the fields in the template. - Of course, the names, labels, unique ID’s, etc, would be accessible as specific fields in the frontmatters of each thing (i.e the children pages themselves
), so the fields automation would pick informations in them.
Now, this being said, and assuming that TWIG is not in use here neither any GRAV normal routine, what we strongly need is :
- Help to build a php “function” based on this documentation page : Advanced Blueprint Features | Grav Documentation, and also on the example given in the part (of the same page) called “CREATING NEW FORM FIELD TYPE”, where a kind of function is shortly drawed.
- Help on GRAV engine basis, like “where to place PHP functions in order to the engine to correctly load them ?”, or “what are the main steps for trying to retrieve a page collection regarding to all the engine classes ?”.
We could more easily work by ourselves if we had any clue on how to proceed.