This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.
Use case: I am defining a number of page variables for separate users to be used to populate sections of a layout. I have a table that defines what variables are associated with a given layout, and what field type and options should be used when presenting a form to the user. These variable definitions are defined using a repeater and stored in the DB in a jsonable field with the layout data. When the user creates a new page and selects the layout, the layout's json repeater data is copied to a jsonable field in the page's table. I then have a repeater on the form used to manage the instance of that page. All that works.
What I would like to be able to do is to make the repeater's individual form fields containing the variable values for the layout appear as the field type defined. I first looked at using formExtendFields and manipulating the form classes structure to be able to change the appropriate fields' types. Obviously, I found that the form object's repeater fields are not yet expanded there. At that point the object contains the repeater's definition and a data structure which will later be used to expand the form appropriately. In case I have not been clear, each element in the repeater may have a different field type and of course the repeater defines the type for all elements.
So, I guess my question is... Is there a hook I can access to modify the repeater's form fields after they have already been expanded but before the form is rendered? (I believe I have found where I might be able to modify the Repeater widget and form module to accomplish this, but clearly would not be desirable to go that deep.
Thanks!
Last updated
1-1 of 1