/** * @return Form */ public function Form() { // Attempt to retrieve a current registration for the logged in member $reg = $this->getCurrentRegistration(); $register = RegistrationPage::get()->First(); // If the user has no registration, redirect them to the registration page if (!$reg) { if ($register) { return $this->redirect($register->AbsoluteLink()); } else { return $this->redirect($this->baseURL); } } if (!$this->userGameRegOpen()) { return false; } // If the user has already added games, redirect them to after submission // @todo: allow users to edit submitted game choices if ($reg->PlayerGames()->Count() > 0) { return $this->redirect($this->Link('yourgames')); } $fields = $this->GameSignupFields($reg); $form = new Form($this, 'Form', $fields, new FieldList(new FormAction('addplayergames', 'Submit'))); $form->enableSpamProtection(); $form->addExtraClass('preference-select'); return $form; }