From 25fe5f6dbb14cbac9c228bff491c9719f1a49f8e Mon Sep 17 00:00:00 2001 From: "Brainforge.UK" Date: Thu, 16 May 2019 17:43:50 +0100 Subject: [PATCH] Added `onContentValidateData` event. Replaces `onUserBeforeDataValidation` event which is now deprecated. --- libraries/src/MVC/Model/FormModel.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/libraries/src/MVC/Model/FormModel.php b/libraries/src/MVC/Model/FormModel.php index dd2ebbc058051..c042274f63d0e 100644 --- a/libraries/src/MVC/Model/FormModel.php +++ b/libraries/src/MVC/Model/FormModel.php @@ -192,7 +192,18 @@ public function validate($form, $data, $group = null) // Include the plugins for the delete events. PluginHelper::importPlugin($this->events_map['validate']); - Factory::getApplication()->triggerEvent('onUserBeforeDataValidation', array($form, &$data)); + $dispatcher = Factory::getContainer()->get('dispatcher'); + + if (!empty($dispatcher->getListeners('onUserBeforeDataValidation'))) { + @trigger_error( + 'The `onUserBeforeDataValidation` event is deprecated and will be removed in 5.0, use the `onContentValidateData` event instead.', + E_USER_DEPRECATED + ); + + Factory::getApplication()->triggerEvent('onUserBeforeDataValidation', array($form, &$data)); + } + + Factory::getApplication()->triggerEvent('onContentValidateData', array($form, &$data)); // Filter and validate the form data. $data = $form->filter($data);