/** * Add fields for personal details and required fields to the validator. * * @param Array $fields Array of fields * @param OrderFormValidator $validator Checkout form validator * @param Member $member Current logged in member, or Member class singleton if no one logged in */ private function addPersonalDetailsFields(&$fields, &$validator, $member) { $emailField = new EmailField('Email', 'Email'); $emailField->setCustomValidationMessage(_t('CheckoutPage.PLEASE_ENTER_EMAIL_ADDRESS', "Please enter your email address.")); $validator->addRequiredField(_t('CheckoutPage.EMAIL', "Email")); $personalFields = new CompositeField(new HeaderField(_t('CheckoutPage.PERSONAL_DETAILS', "Personal Details"), 3), new CompositeField($emailField, new TextField('HomePhone', _t('CheckoutPage.PHONE', "Phone")))); if (!$member->ID || $member->Password == '') { $link = $this->Link(); $note = _t('CheckoutPage.NOTE', 'NOTE:'); $passwd = _t('CheckoutPage.PLEASE_CHOOSE_PASSWORD', 'Please choose a password, so you can login and check your order history in the future.'); $member = sprintf(_t('CheckoutPage.ALREADY_MEMBER', 'If you are already a member please %s log in. %s'), "<a href=\"Security/login?BackURL={$link}\">", '</a>'); $lit = <<<EOS <p class="alert alert-info"> \t<strong class="alert-heading">{$note}</strong> \t{$passwd} <br /><br /> \t{$member} </p> EOS; $personalFields->push(new CompositeField(new FieldGroup(new ConfirmedPasswordField('Password', _t('CheckoutPage.PASSWORD', "Password"))), new LiteralField('AccountInfo', $lit))); $validator->addRequiredField('Password'); } $personalFields->setID('PersonalDetails'); $fields['PersonalDetails'][] = $personalFields; }