/** * Hook that loads the form data from $_POST or the model * * Or from whatever other source you specify here. */ protected function loadFormData() { if (!$this->request->isPost()) { if ($this->respondent instanceof \Gems_Tracker_Respondent) { $this->formData = $this->respondent->getArrayCopy(); } } if (!$this->formData) { parent::loadFormData(); } $model = $this->getModel(); $model->set('restore_tracks', 'label', $this->_('Restore tracks'), 'description', $this->_('Restores tracks with the same code as the respondent.'), 'elementClass', 'Checkbox'); if (!array_key_exists('restore_tracks', $this->formData)) { $this->formData['restore_tracks'] = 1; } }
/** * The place to check if the data set in the snippet is valid * to generate the snippet. * * When invalid data should result in an error, you can throw it * here but you can also perform the check in the * checkRegistryRequestsAnswers() function from the * {@see \MUtil_Registry_TargetInterface}. * * @return boolean */ public function hasHtmlOutput() { if ($this->model) { $this->model->setIfExists('grs_email', 'itemDisplay', array('MUtil_Html_AElement', 'ifmail')); $this->model->setIfExists('gr2o_comments', 'rowspan', 2); if ($this->showConsentWarning && $this->model->has('gr2o_consent')) { $this->model->set('gr2o_consent', 'formatFunction', array($this, 'checkConsent')); } if (!$this->repeater) { if (!$this->respondent) { $this->repeater = $this->model->loadRepeatable(); } else { $data = array($this->respondent->getArrayCopy()); $this->repeater = \MUtil_Lazy::repeat($data); } } return true; } return false; }