public function getCMSFields() { $fields = parent::getCMSFields(); $fields->addFieldsToTab('Root.Main', PhoneNumberField::create('Age', 'Age num')); $fields->addFieldsToTab('Root.Main', TextField::create('Job', 'Your Job')); return $fields; }
public function ApplicationForm() { $fields = FieldList::create(TextField::create('Name', 'Full name'), EmailField::create('Email', 'Email address'), PhoneNumberField::create('Phone', 'Contact Phone number'), DropdownField::create('JobID', 'Which job are you applying for?', $this->AvailableJobs()->map('ID', 'Title'))->setEmptyString('(Select)'), TextareaField::create('Application', 'Enter your experience and skills')); $actions = FieldList::create(FormAction::create('processApplication', 'Apply')); $validator = RequiredFields::create(array('Name', 'Email', 'Phone', 'JobID', 'Application')); $form = Form::create($this, 'ApplicationForm', $fields, $actions, $validator); return $form; }
public function getCMSFields() { $fields = parent::getCMSFields(); $fields->addFieldToTab('Root.Main', UploadField::create('Photo'), 'Content'); $fields->addFieldToTab('Root.Main', UploadField::create('PDF'), 'Content'); $fields->addFieldToTab('Root.Main', PhoneNumberField::create('Phone'), 'Content'); $fields->addFieldToTab('Root.Main', EmailField::create('Email'), 'Content'); $fields->addFieldToTab('Root.Main', DropdownField::create('RoleID', 'Role', Role::get()->map('ID', 'Title'))->setEmptyString('(Select)'), 'Content'); $fields->addFieldToTab('Root.Main', DropdownField::create('DepartmentID', 'Department', Department::get()->map('ID', 'Title'))->setEmptyString('(Select)'), 'Content'); return $fields; }
public function getCMSFields() { $fields = parent::getCMSFields(); $fields->addFieldToTab("Root.Main", new TextField("textfield", "Text field"), 'Metadata'); $fields->addFieldToTab("Root.Main", new TextAreaField("textarea", "Textarea"), 'Metadata'); $fields->addFieldToTab('Root.Main', new CheckboxField('ShowInSearch', 'Show in search?'), 'Metadata'); $fields->addFieldToTab('Root.Main', OptionsetField::create('Icon', 'Icon', array(1 => 'option 1', 2 => 'option 2')), 'Metadata'); $fields->addFieldToTab('Root.Main', new HTMLEditorField('Description', 'Description'), 'Metadata'); $fields->addFieldToTab('Root.Main', new HiddenField('Referrer', 'Referrer', 'listview'), 'Metadata'); $fields->addFieldToTab('Root.Main', new DateField('datefoeld'), 'Metadata'); $fields->addFieldToTab('Root.Main', EmailField::create('Email', 'Email'), 'Metadata'); $fields->addFieldToTab('Root.Main', PhoneNumberField::create('Phone', 'Phone'), 'Metadata'); return $fields; }
public function getShippingFields() { $fields = array("shippingAddress1" => TextField::create('shippingAddress1', _t("PaymentForm.SHIPPINGADDRESS1", "Shipping Address")), "shippingAddress2" => TextField::create('shippingAddress2', _t("PaymentForm.SHIPPINGADDRESS2", "Shipping Address 2")), "city" => TextField::create('shippingCity', _t("PaymentForm.SHIPPINGCITY", "Shipping City")), "postcode" => TextField::create('shippingPostcode', _t("PaymentForm.SHIPPINGPOSTCODE", "Shipping Postcode")), "state" => TextField::create('shippingState', _t("PaymentForm.SHIPPINGSTATE", "Shipping State")), "country" => TextField::create('shippingCountry', _t("PaymentForm.SHIPPINGCOUNTRY", "Shipping Country")), "phone" => PhoneNumberField::create('shippingPhone', _t("PaymentForm.SHIPPINGPHONE", "Shipping Phone"))); $this->cullForGateway($fields); return FieldList::create($fields); }
/** * Create form fields to represent all of the properties on the {@link Omnipay\Common\CreditCard} object. * The form fields are split up into relevent sections to help with adding/removing fields as needed. * * @return FieldList */ protected function getCreditCardFields() { $fields = new FieldList(); $tabindex = 1; // Create personal detail fields $firstNameTextField = new TextField('FirstName', _t('OmnipayableForm.FIRSTNAME', 'First name')); $firstNameTextField->setAttribute('tabindex', $tabindex++); $lastNameTextField = new TextField('LastName', _t('OmnipayableForm.LASTNAME', 'Last name')); $lastNameTextField->setAttribute('tabindex', $tabindex++); $companyTextField = new TextField('Company', _t('OmnipayableForm.COMPANY', 'Company')); $companyTextField->setAttribute('tabindex', $tabindex++); $emailEmailField = new EmailField('Email', _t('OmnipayableForm.EMAIL', 'Email')); $emailEmailField->setAttribute('tabindex', $tabindex++); // Create personal details group $personalFieldGroup = new FieldGroup(); $personalFieldGroup->setName('PersonalDetails'); $personalFieldGroup->setTitle(_t('OmnipayableForm.PERSONALDETAILS', 'Personal Detials')); // Add basic fields to personal details group $personalFieldGroup->push($firstNameTextField); $personalFieldGroup->push($lastNameTextField); $personalFieldGroup->push($companyTextField); $personalFieldGroup->push($emailEmailField); // Add personal details group to fields $fields->push($personalFieldGroup); // Create credit card detail fields $numberCreditCardField = new CreditCardField('Number', _t('OmnipayableForm.NUMBER', 'Card number')); $numberCreditCardField->setAttribute('tabindex', $tabindex++); $cvvTextField = new TextField('Cvv', _t('OmnipayableForm.CVV', 'Security number')); $cvvTextField->setAttribute('tabindex', $tabindex += 3); $expiryMonthDropdownField = new DropdownField('ExpiryMonth', _t('OmnipayableForm.EXPIRYMONTH', 'Expiry month'), $this->getMonths()); $expiryMonthDropdownField->setAttribute('tabindex', $tabindex++); $expiryMonthDropdownField->setHasEmptyDefault(true); $expiryYearDropdownField = new DropdownField('ExpiryYear', _t('OmnipayableForm.EXPIRYYEAR', 'Expiry year'), $this->getYears(20)); $expiryYearDropdownField->setAttribute('tabindex', $tabindex++); $expiryYearDropdownField->setHasEmptyDefault(true); $startMonthDropdownField = new DropdownField('StartMonth', _t('OmnipayableForm.STARTMONTH', 'Start month'), $this->getMonths()); $startMonthDropdownField->setAttribute('tabindex', $tabindex++); $startMonthDropdownField->setHasEmptyDefault(true); $startYearDropdownField = new DropdownField('StartYear', _t('OmnipayableForm.STARTYEAR', 'Start year'), $this->getYears(-20)); $startYearDropdownField->setAttribute('tabindex', $tabindex++); $startYearDropdownField->setHasEmptyDefault(true); $issueNumberTextField = new TextField('IssueNumber', _t('OmnipayableForm.ISSUENUMBER', 'Issue number')); $issueNumberTextField->setAttribute('tabindex', $tabindex++); $typeDropdownField = new DropdownField('Type', _t('OmnipayableForm.TYPE', 'Card type'), $this->getCreditCardTypes()); $typeDropdownField->setAttribute('tabindex', $tabindex++); $typeDropdownField->setHasEmptyDefault(true); $expiryDateFieldGroup = new FieldGroup(); $expiryDateFieldGroup->push($expiryMonthDropdownField); $expiryDateFieldGroup->push($expiryYearDropdownField); $startDateFieldGroup = new FieldGroup(); $startDateFieldGroup->push($startMonthDropdownField); $startDateFieldGroup->push($startYearDropdownField); // Create credit card details group $creditCardFieldGroup = new FieldGroup(); $creditCardFieldGroup->setName('CardDetails'); $creditCardFieldGroup->setTitle(_t('OmnipayableForm.CREDITCARDDETAILS', 'Card Detials')); // Add credit card fields to credit card details group $creditCardFieldGroup->push($numberCreditCardField); $creditCardFieldGroup->push($cvvTextField); $creditCardFieldGroup->push($expiryDateFieldGroup); $creditCardFieldGroup->push($startDateFieldGroup); $creditCardFieldGroup->push($issueNumberTextField); $creditCardFieldGroup->push($typeDropdownField); // Add credit card details group to fields $fields->push($creditCardFieldGroup); // Create billing address fields $billingAddress1TextField = new TextField('BillingAddress1', _t('OmnipayableForm.BILLINGADDRESS1', 'Address 1')); $billingAddress1TextField->setAttribute('tabindex', $tabindex++); $billingAddress2TextField = new TextField('BillingAddress2', _t('OmnipayableForm.BILLINGADDRESS2', 'Address 2')); $billingAddress2TextField->setAttribute('tabindex', $tabindex++); $billingCity = new TextField('BillingCity', _t('OmnipayableForm.BILLINGCITY', 'City')); $billingCity->setAttribute('tabindex', $tabindex++); $billingPostcode = new TextField('BillingPostcode', _t('OmnipayableForm.BILLINGPOSTCODE', 'Postcode')); $billingPostcode->setAttribute('tabindex', $tabindex++); $billingState = new TextField('BillingState', _t('OmnipayableForm.BILLINGSTATE', 'State')); $billingState->setAttribute('tabindex', $tabindex++); $billingCountry = new CountryDropdownField('BillingCountry', _t('OmnipayableForm.BILLINGCOUNTRY', 'Country')); $billingCountry->setAttribute('tabindex', $tabindex++); $billingPhone = new PhoneNumberField('BillingPhone', _t('OmnipayableForm.BILLINGPHONE', 'Phone')); $billingPhone->setAttribute('tabindex', $tabindex++); // Create billing details group $billingFieldGroup = new FieldGroup(); $billingFieldGroup->setName('BillingAddress'); $billingFieldGroup->setTitle(_t('OmnipayableForm.BILLING', 'Billing Address')); // Add billiing fields to billing group $billingFieldGroup->push($billingAddress1TextField); $billingFieldGroup->push($billingAddress2TextField); $billingFieldGroup->push($billingCity); $billingFieldGroup->push($billingPostcode); $billingFieldGroup->push($billingState); $billingFieldGroup->push($billingCountry); $billingFieldGroup->push($billingPhone); // Add billing details group to fields $fields->push($billingFieldGroup); // Create shipping address fields $shippingAddress1TextField = new TextField('ShippingAddress1', _t('OmnipayableForm.SHIPPINGADDRESS1', 'Address 1')); $shippingAddress1TextField->setAttribute('tabindex', $tabindex++); $shippingAddress2TextField = new TextField('ShippingAddress2', _t('OmnipayableForm.SHIPPINGADDRESS2', 'Address 2')); $shippingAddress2TextField->setAttribute('tabindex', $tabindex++); $shippingCity = new TextField('ShippingCity', _t('OmnipayableForm.SHIPPINGCITY', 'City')); $shippingCity->setAttribute('tabindex', $tabindex++); $shippingPostcode = new TextField('ShippingPostcode', _t('OmnipayableForm.SHIPPINGPOSTCODE', 'Postcode')); $shippingPostcode->setAttribute('tabindex', $tabindex++); $shippingState = new TextField('ShippingState', _t('OmnipayableForm.SHIPPINGSTATE', 'State')); $shippingState->setAttribute('tabindex', $tabindex++); $shippingCountry = new CountryDropdownField('ShippingCountry', _t('OmnipayableForm.SHIPPINGCOUNTRY', 'Country')); $shippingCountry->setAttribute('tabindex', $tabindex++); $shippingPhone = new PhoneNumberField('ShippingPhone', _t('OmnipayableForm.SHIPPINGPHONE', 'Phone')); $shippingPhone->setAttribute('tabindex', $tabindex++); // Create shipping details group $shippingFieldGroup = new FieldGroup(); $shippingFieldGroup->setName('ShippingAddress'); $shippingFieldGroup->setTitle(_t('OmnipayableForm.SHIPPING', 'Shipping Address')); // Add billiing fields to shipping group $shippingFieldGroup->push($shippingAddress1TextField); $shippingFieldGroup->push($shippingAddress2TextField); $shippingFieldGroup->push($shippingCity); $shippingFieldGroup->push($shippingPostcode); $shippingFieldGroup->push($shippingState); $shippingFieldGroup->push($shippingCountry); $shippingFieldGroup->push($shippingPhone); // Add shipping details group to fields $fields->push($shippingFieldGroup); return $fields; }
/** * Get shipping address fields * @return \FieldList */ public function getShippingFields() { $fields = array('shippingAddress1' => \TextField::create('shippingAddress1', _t('PaymentForm.ShippingAddress1', 'Shipping Address')), 'shippingAddress2' => \TextField::create('shippingAddress2', _t('PaymentForm.ShippingAddress2', 'Shipping Address 2')), 'city' => \TextField::create('shippingCity', _t('PaymentForm.ShippingCity', 'Shipping City')), 'postcode' => \TextField::create('shippingPostcode', _t('PaymentForm.ShippingPostcode', 'Shipping Postcode')), 'state' => \TextField::create('shippingState', _t('PaymentForm.ShippingState', 'Shipping State')), 'country' => \TextField::create('shippingCountry', _t('PaymentForm.ShippingCountry', 'Shipping Country')), 'phone' => \PhoneNumberField::create('shippingPhone', _t('PaymentForm.ShippingPhone', 'Shipping Phone'))); $this->cullForGateway($fields); return \FieldList::create($fields); }