Skip to content
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

New event "init_form_values_after" after data set on a form #1485

Merged
merged 2 commits into from
Mar 11, 2021

Conversation

woutersamaey
Copy link
Contributor

@woutersamaey woutersamaey commented Mar 4, 2021

Magento does not have a common event after data is set on a form.
This new event allows us to change the form, the elements and the values once data is entered, giving full flexibility.
I needed this event in a special case where I needed to change the options of a select, to include the current value that was not in the existing options list.
There was no other way to do this without overriding many forms 1 by 1.

Contribution checklist (*)

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All automated tests passed successfully (all builds are green)

Magento does not have a common event after data is set on a form.
This new event allows us to change the form, the elements and the values once data is entered, giving full flexibility.
I needed this event in a special case where I needed to change the options of a select, to include the current value that was not in the existing options list.
There was no other way to do this without overriding many forms 1 by 1.
@github-actions github-actions bot added the Component: Adminhtml Relates to Mage_Adminhtml label Mar 4, 2021
colinmollenhour
colinmollenhour previously approved these changes Mar 4, 2021
Copy link
Member

@colinmollenhour colinmollenhour left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent addition!

If I was designing from scratch I'd probably add a second event with a default overridable prefix to it like $this->_eventPrefix.'_form_before_html' so that the eventPrefix can be added to classes making it easier to override the specific form using the event name (same as models). But with or without this should have been added years ago. :)

@sreichel
Copy link
Contributor

sreichel commented Mar 4, 2021

Excellent addition!

If I was designing from scratch I'd probably add a second event with a default overridable prefix to it like $this->_eventPrefix.'_form_before_html' so that the eventPrefix can be added to classes making it easier to override the specific form using the event name (same as models). But with or without this should have been added years ago. :)

OT: Is it worth tackling #423 again? You had some conserns here #423 (comment) ... but i'm still not sure how to fix it.

Co-authored-by: Ng Kiat Siong <kiatsiong.ng@gmail.com>
@woutersamaey
Copy link
Contributor Author

Thanks for the great suggestions @kiatng

@woutersamaey
Copy link
Contributor Author

@colinmollenhour and @sreichel can we get this merged?

@sreichel sreichel merged commit 419518e into OpenMage:1.9.4.x Mar 11, 2021
@sreichel sreichel added this to the Release 19.4.12 / 20.0.8 milestone Mar 11, 2021
@github-actions
Copy link
Contributor

Unit Test Results

1 files  ±0  1 suites  ±0   0s ⏱️ ±0s
0 tests ±0  0 ✔️ ±0  0 💤 ±0  0 ❌ ±0 
2 runs  ±0  2 ✔️ ±0  0 💤 ±0  0 ❌ ±0 

Results for commit 419518e. ± Comparison against base commit 0e2f81d.

@sreichel sreichel mentioned this pull request Mar 11, 2021
3 tasks
@kiatng kiatng mentioned this pull request May 31, 2021
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Adminhtml Relates to Mage_Adminhtml new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants