codefog / contao-haste

Haste is a collection of tools and classes to ease working with Contao
http://codefog.pl/extension/haste.html
MIT License
42 stars 24 forks source link

Pass DataContainer to getAttributesFromDca #144

Closed fritzmg closed 5 years ago

fritzmg commented 5 years ago

I have a DCA with a pid relation to a parent table. I am using addFieldsFromDca of Haste\Form\Form to render form fields of the DCA fields in the front end. However, one of those fields has an options_callback where, depending on the pid, different options are shown to the user.

I still need this callback in the front end, as I want to show the user the correct options. However, no DataContainer will be passed to that callback in the front end.

Similar to the save_callback, we could pass a mock DCA object here as well, when there is a model binding present. What do you think?

qzminski commented 5 years ago

Looks good to me. @aschempp @Toflar

fritzmg commented 5 years ago

Technically one could have models without a DCA, couldn't they?

Toflar commented 5 years ago

Maybe yeah

fritzmg commented 5 years ago

I have added additional checks.

qzminski commented 5 years ago

Thank you @fritzmg, I have just released 4.24.0 so you can update your deps.