-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
[4.0] Added event onContentValidateData #25103
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
[4.0] Added event onContentValidateData #25103
Conversation
For Joomla issue 19584
|
Replaces pull request #24925 |
|
I cannot understand the usefulness of that change. |
|
The event name onUserBeforeDataValidation implies it is only for user validation. |
| Factory::getApplication()->triggerEvent('onUserBeforeDataValidation', array($form, &$data)); | ||
| } | ||
|
|
||
| Factory::getApplication()->triggerEvent('onContentValidateData', array($form, &$data)); |
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.
To be consistent with the other events (using before/after) something like onBeforeDataValidation possibly would be better
|
My main point in raising / proposing this is to replace the event name with something more meaningful when using it outside of user validation - code easier to read / search. It occurs during validation so an On... name places it within validation while OnBefore... would imply it is outside validation. A quick code search shows other OnContent... events including onContentBeforeDelete and onContentAfterDelete so naming it onContentValidateData looks like it fits in with previously used naming conventions. |
The event is triggered before the validation logic. It is important to clarify if it is called before or after, to be clear what actions could be carried out through that. Also onContentValidateData implies that the data are validated by that, which is not the case. |
|
Thanks! |
Pull Request for Issue #24901.
Summary of Changes
Added event onContentValidateData
Event onUserBeforeDataValidation now depracted
Testing Instructions
Create a field plugin which implements onContentValidateData function like this...
public function onContentValidateData($form, &$data) {
// Change the data in some way
}
Expected result
The data get's changed.
Actual result
The data get's changed.
Documentation Changes Required
Add documentation for onContentValidateData event.
Add documentation for the existing, but undocumented and now deprecated, onUserBeforeDataValidation event.