/** * 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->respondentData) { $this->repeater = $this->model->loadRepeatable(); } else { // In case a single array of values was passed: make nested if (is_array(reset($this->respondentData))) { $data = $this->respondentData; } else { $data = array($this->respondentData); } $this->repeater = \MUtil_Lazy::repeat($data); } } return true; } return false; }
/** * 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; }