Skip to content

Commit

Permalink
Added onContentValidateData event.
Browse files Browse the repository at this point in the history
Replaces `onUserBeforeDataValidation` event which is now deprecated.
  • Loading branch information
BrainforgeUK committed May 16, 2019
1 parent 9087899 commit 25fe5f6
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion libraries/src/MVC/Model/FormModel.php
Expand Up @@ -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);
Expand Down

0 comments on commit 25fe5f6

Please sign in to comment.