I made a plugin to solve my problem of generating fields (or form attributes) retrieving data from other pages. It works fine and it is almost generic. But, there is a but. Here is how I call my plugin within the form:
form: name: voting fields: - name: fieldset type: fieldset label: Fieldset data-fields@: [\Grav\Plugin\DynamicFormPlugin::mapPropertyToFormAttribute, [01.home/07._nomeados, header.categories]]
The first argument passed to
DynamicFormPlugin::field is the page path. The second argument is the property that I want to use to populate my fields.
The problem: I need to pass a method (or a path to the method, I couldn’t find out how that works with grav, yaml nor php) to
DynamicFormPlugin::field, so it could use that function to map the property to the form attribute.
I thought about passing
class::method as a third argument to
DynamicFormPlugin::field. But I don’t know how to call the method later.