Hammerfels 9
Changing the record for the modal of a form/action
Okay. I don't have the action in a table. I'll dig a little further.
I am currently making a plugin with which you can create customized forms as a user.
To create these forms I have a more complex form schema.
Now I have a different model, let's take "Product" as an example. Product has a relation to CustomForm. To make it more comfortable for the user. Should the user have the possibility to press a button (form/action) while editing the product and then the modal should open with the form of the CustomForm. However, for the form to work, the $record variable in the closer functions of the CustomForm schema must be executed with the CustomForm $record. Which means that I have to change the model/record in the modal. And my question is how I can convert the record from this form action in the modal.
As explained above I tried to change the model in the form of the modal with $this->mountUsing(fn (form $form) => $form->model($myRecord)); this works until the user makes any interaction.
I also tried to override resolveDefaultClosureDependencyForEvaluationByName() in the Action class to pass the CustomForm model as a record.
6 replies