function requireDefaultRecords() { parent::requireDefaultRecords(); $simplestSpamFieldQuestion = SimplestSpamFieldQuestion::get()->First(); if (!$simplestSpamFieldQuestion) { $simplestSpamFieldQuestion = new SimplestSpamFieldQuestion(); $simplestSpamFieldQuestion->Question = 'What is the original name for New Zealand?'; $simplestSpamFieldQuestion->Answer = 'Aotearoa'; $simplestSpamFieldQuestion->write(); DB::alteration_message($simplestSpamFieldQuestion->ClassName . "Created default entry for SimplestSpamFieldQuestion", 'created'); } }
protected function getQuestionAnswerObject() { $this->initialise(); $number = Session::get("SimplestSpamQuestion"); if ($number > 0) { $number = $number - 1; if (($dos = SimplestSpamFieldQuestion::get()->limit(1, $number))->count()) { return $dos->first(); } else { $this->error = _t("SimplestSpamField.QUESTIONNOTFOUND", "Selected question not found."); } } else { $this->error = _t("SimplestSpamField.QUESTIONSELECTIONNOTAVAILABLE", "No question selection made."); } return false; }