I was looking for a fields plugin event called when an article using customs fields (com_field) is saved.
I found FormModel::validate() function triggers onUserBeforeDataValidation event.
Adding function onUserBeforeDataValidation($form, &data) to my field plugin produces the functionality I require.
(a) Documentation for the onUserBeforeDataValidation event
(b) A more meaningful event name e.g. onFormModelBeforeDataValidation
(a) I could not find any documentation for this event
(b) Looks like original author for this event was too focused on the user problem they wanted to solve and not thinking of the wider applications of this event.
Joomla 3.8.4
Suggest changing FormModel::validate() function to something like the following:
if (get_class($this) == 'UsersModelUser') {
// Obsolete, kept here for backward compatibility
$dispatcher->trigger('onUserBeforeDataValidation', array($form, &$data));
}
$dispatcher->trigger('onFormModelDataValidation', array($form, &$data));
Labels |
Added:
?
|
Category | ⇒ | com_plugins |
Status | New | ⇒ | Discussion |
Labels |
Added:
J3 Issue
|
Pull requests are welcome
Status | Discussion | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2018-04-12 15:15:19 |
Closed_By | ⇒ | franz-wohlkoenig |
Closed_By | franz-wohlkoenig | ⇒ | joomla-cms-bot |
Set to "closed" on behalf of @franz-wohlkoenig by The JTracker Application at issues.joomla.org/joomla-cms/19584
Interesting subject!
a) The code is located in /libraries/src/MVC/Model/FormModel.php in line 355 :
$dispatcher->trigger('onUserBeforeDataValidation', array($form, &$data));
There is 2 parameters :
b) I agree, the name of this event should be updated to onForm... or onContent... (like the others triggered events in this class)