Does anyone know how to generate dynamic field properties using 'data-fields@ ’ ? On grav documentation it is mentioned that we can use data-type / label / validation / field but no example is given how ? Can anyone point me in the right direction ?
Hello @I4mabdul, welcome to the Grav forum.
The documentation on dynamic fields is rather basic.
The Form Prefiller Plugin though has a couple of use cases in it’s example page like setting option field values, getting the current time and date and localised field labels based on the Grav active language.
Thanks @bleutzinn . Appreciate your help. I was wondering if we could generate fields like label => ’ Name’ , ‘type’ => ’ text ’ using ‘data-fields@’ ?
Basically my idea is to output label from one blueprint and have text field generated against it using ‘data-fields@’ in another blueprint so that i can edit it using admin panel.
You can. When you set values for
type through a form which uses the first blueprints and then use
data-type@ in the second. I’ve never tried
data-type@ but in theory it should work.
Another suggestion since you want to create a form field dynamically, is to look at how the Dynamic Form Plugin does exactly that.