class scStudentAssignmentUpdateProcessor extends modObjectUpdateProcessor {
public $classKey = 'scStudentAssignment';
public $languageTopics = array('studentcentre:default');
public $objectType = 'studentcentre.ass';
public function beforeSet() {
$comment = $this->getProperty('comment');
$saId = $this->getProperty('id');
$userId = $this->getProperty('userId');
$processorsPath = $this->getProperty('processorsPath');
if (empty($comment)) { // check to see if the comment field is empty. if so throw error response
$this->addFieldError('comment',$this->modx->lexicon('studentcentre.ass_err_ns_comment'));
} else {
$response = $this->modx->runProcessor('mgr/assignments/scCommentCreate', array(
'comment' => $comment,
'student_assignment_id' => $saId,
'user_id' => $userId,
), array(
'processors_path' => $processorsPath,
)
);
if ($response->isError()) {
return $this->failure($response->getMessage());
}
}
return parent::beforeSet();
}
}
return 'scStudentAssignmentUpdateProcessor';This question has been answered by BobRay. See the first response.
return $this->failure('MyMessage');return $this->failure($this->modx->lexicon('my_message_key'));