-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Form] dispatch submit events for disabled forms too #33381
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Firstly, isn't it actually a new feature? Dispatching those events here is a new behavior. Some listeners will be executed while they were not until now. Secondly, the events are chained dispatched but they don't use / encapsulate the (current) expected data. For example, the view data encapsulated in the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left a small comment, otherwise LGTM
Up. |
69520cb
to
f781150
Compare
Thank you @xabbuh. |
// Obviously, a disabled form should not change its data upon submission. | ||
if ($this->isDisabled()) { | ||
if ($this->isDisabled() && $this->isRoot()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for late feedback, but, if I'm not missing something, I think this change will break the current behavior.
Assuming you have a child field disabled, getting its value this way $form->get('field')->getData()
will return the submitted data rather than its initial value as expected.
It is likely that the new condition $this->isRoot()
should group the new code (the events being dispatched) in place, thus keeping the previous behavior of ignoring disabled child forms.
Some BC breaks here found in #38025, I'm not sure if should we revert this or fix them? |
@xabbuh I let you see if you prefer to revert for now or if we are confident that we will be able to fix the BC breaks before the release. |
Reverting |
TODO: