From a5337cfe5c688c8b7bc91135af47cbafe7c0527d Mon Sep 17 00:00:00 2001 From: Frédéric Guillot Date: Tue, 23 Sep 2014 20:16:07 +0200 Subject: Move task edit form to the task layout --- app/Model/TaskValidator.php | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) (limited to 'app/Model') diff --git a/app/Model/TaskValidator.php b/app/Model/TaskValidator.php index 461c03d4..1c7b0b14 100644 --- a/app/Model/TaskValidator.php +++ b/app/Model/TaskValidator.php @@ -79,13 +79,35 @@ class TaskValidator extends Base } /** - * Validate task modification + * Validate task modification (form) * * @access public * @param array $values Form values * @return array $valid, $errors [0] = Success or not, [1] = List of errors */ public function validateModification(array $values) + { + $rules = array( + new Validators\Required('id', t('The id is required')), + new Validators\Required('title', t('The title is required')), + ); + + $v = new Validator($values, array_merge($rules, $this->commonValidationRules())); + + return array( + $v->execute(), + $v->getErrors() + ); + } + + /** + * Validate task modification (Api) + * + * @access public + * @param array $values Form values + * @return array $valid, $errors [0] = Success or not, [1] = List of errors + */ + public function validateApiModification(array $values) { $rules = array( new Validators\Required('id', t('The id is required')), -- cgit v1.2.3