/**
  * getCMSFields
  * Construct the FieldList used in the CMS. To provide a
  * smarter UI we don't use the scaffolding provided by
  * parent::getCMSFields.
  * 
  * @return FieldList
  */
 public function getCMSFields()
 {
     Requirements::css('torindul-silverstripe-shop/css/LeftAndMain.css');
     //Create the FieldList and push the Root TabSet on to it.
     $fields = FieldList::create($root = TabSet::create('Root', Tab::create("Main", HeaderField::create("Add/Edit Tax Zone"), CompositeField::create(DropdownField::create("Enabled", "Enable this zone?", array("1" => "Yes", "2" => "No"))->setRightTitle($this->SystemCreated == 1 && $this->exists() ? "DISABLED: You can not disable the default tax zone." : "If enabled your store will use the rates defined in this zone for customers in the selected country.")->setDisabled($this->SystemCreated == 1 && $this->exists() ? true : false), !$this->exists() ? CountryDropdownField::create("Title", "Country")->setRightTitle($this->SystemCreated == 1 && $this->exists() ? "DISABLED: You can not select a country as this zone applies to all countries." : "Select the country this zone applies to.")->setDisabled($this->SystemCreated == 1 && $this->exists() ? true : false) : "", $this->exists() ? GridField::create("TaxZones_TaxRates", "Tax Rates within the '" . $this->Title . "' Tax Zone", $this->TaxRates(), GridFieldConfig_RecordEditor::create()) : ""))));
     return $fields;
 }
 function TypoForm()
 {
     $array = array('green', 'yellow', 'blue', 'pink', 'orange');
     $form = new Form($this, 'TestForm', $fields = FieldList::create(HeaderField::create('HeaderField1', 'HeaderField Level 1', 1), LiteralField::create('LiteralField', '<p>All fields up to EmailField are required and should be marked as such</p>'), TextField::create('TextField1', 'Text Field Example 1'), TextField::create('TextField2', 'Text Field Example 2'), TextField::create('TextField3', 'Text Field Example 3'), TextField::create('TextField4', ''), HeaderField::create('HeaderField2b', 'Field with right title', 2), $textAreaField = new TextareaField('TextareaField', 'Textarea Field'), EmailField::create('EmailField', 'Email address'), HeaderField::create('HeaderField2c', 'HeaderField Level 2', 2), DropdownField::create('DropdownField', 'Dropdown Field', array(0 => '-- please select --', 1 => 'test AAAA', 2 => 'test BBBB')), OptionsetField::create('OptionSF', 'Optionset Field', $array), CheckboxSetField::create('CheckboxSF', 'Checkbox Set Field', $array), CountryDropdownField::create('CountryDropdownField', 'Countries'), CurrencyField::create('CurrencyField', 'Bling bling', '$123.45'), HeaderField::create('HeaderField3', 'Other Fields', 3), NumericField::create('NumericField', 'Numeric Field '), DateField::create('DateField', 'Date Field'), DateField::create('DateTimeField', 'Date and Time Field'), CheckboxField::create('CheckboxField', 'Checkbox Field')), $actions = FieldList::create(FormAction::create('submit', 'Submit Button')), $requiredFields = RequiredFields::create('TextField1', 'TextField2', 'TextField3', 'ErrorField1', 'ErrorField2', 'EmailField', 'TextField3', 'RightTitleField', 'CheckboxField', 'CheckboxSetField'));
     $textAreaField->setColumns(45);
     $form->setMessage('warning message', 'warning');
     return $form;
 }
 public function getCMSFields()
 {
     $fields = FieldList::create(TabSet::create('Root'));
     $fields->addFieldsToTab('Root.Main', array(TextField::create('Title'), TextareaField::create('Description'), DropdownField::create('CategoryID', 'Category')->setSource(DirectoryCategory::get()->map('ID', 'Title'))->setEmptyString('-- Select a category --'), TextField::create('Manager'), TextareaField::create('Address'), TextField::create('City'), CountryDropdownField::create('Country'), TextField::create('Website'), TextField::create('Email'), TextField::create('Phone'), DateField::create('Date')->setConfig('showcalendar', true)->setConfig('dateformat', 'd MMMM yyyy')));
     $fields->addFieldToTab('Root.Photos', $upload = UploadField::create('Photo', 'Photo'));
     $upload->getValidator()->setAllowedExtensions(array('png', 'jpeg', 'jpg', 'gif'));
     $upload->setFolderName('directory-photos');
     return $fields;
 }
 /**
  * Form used for adding or editing addresses
  */
 public function AddressForm()
 {
     $personal_fields = CompositeField::create(HeaderField::create('PersonalHeader', _t('Checkout.PersonalDetails', 'Personal Details'), 2), TextField::create('FirstName', _t('Checkout.FirstName', 'First Name(s)')), TextField::create('Surname', _t('Checkout.Surname', 'Surname')), CheckboxField::create('Default', _t('Checkout.DefaultAddress', 'Default Address?'))->setRightTitle(_t('Checkout.Optional', 'Optional')))->setName("PersonalFields")->addExtraClass('unit')->addExtraClass('size1of2')->addExtraClass('unit-50');
     $address_fields = CompositeField::create(HeaderField::create('AddressHeader', _t('Checkout.Address', 'Address'), 2), TextField::create('Address1', _t('Checkout.Address1', 'Address Line 1')), TextField::create('Address2', _t('Checkout.Address2', 'Address Line 2'))->setRightTitle(_t('Checkout.Optional', 'Optional')), TextField::create('City', _t('Checkout.City', 'City')), TextField::create('PostCode', _t('Checkout.PostCode', 'Post Code')), CountryDropdownField::create('Country', _t('Checkout.Country', 'Country'))->setAttribute("class", 'countrydropdown dropdown'))->setName("AddressFields")->addExtraClass('unit')->addExtraClass('size1of2')->addExtraClass('unit-50');
     $fields = FieldList::create(HiddenField::create("ID"), HiddenField::create("OwnerID"), CompositeField::create($personal_fields, $address_fields)->setName("DeliveryFields")->addExtraClass('line')->addExtraClass('units-row'));
     $actions = FieldList::create(LiteralField::create('BackButton', '<a href="' . $this->owner->Link('addresses') . '" class="btn btn-red">' . _t('Checkout.Cancel', 'Cancel') . '</a>'), FormAction::create('doSaveAddress', _t('Checkout.Add', 'Add'))->addExtraClass('btn')->addExtraClass('btn-green'));
     $validator = RequiredFields::create(array('FirstName', 'Surname', 'Address1', 'City', 'PostCode', 'Country'));
     $form = Form::create($this->owner, "AddressForm", $fields, $actions, $validator);
     return $form;
 }
 /**
  * getCMSFields
  * Construct the FieldList used in the CMS. To provide a
  * smarter UI we don't use the scaffolding provided by
  * parent::getCMSFields.
  * 
  * @return FieldList
  */
 public function getCMSFields()
 {
     Requirements::css('torindul-silverstripe-shop/css/LeftAndMain.css');
     /**
      * In order to keep the automatic construction of the has_one relationship in the backgroud we will make 
      * use of the parent's getCMSFields() and not create our own FieldList as in other models 
      */
     $fields = parent::getCMSFields();
     //Remove fields
     $fields->removeFieldsFromTab("Root.Main", array("FirstName", "Surname", "CompanyName", "PhoneNumber", "AddressLine1", "AddressLine2", "City", "StateCounty", "Country", "Postcode", "AddressType", "CustomerID"));
     $fields->addFieldsToTab("Root.Main", array(HeaderField::create("Add/Edit Address"), CompositeField::create(DropdownField::create("AddressType", "Address Type", array("1" => "Residential", "2" => "Commercial")), TextField::create("FirstName", "First Name"), TextField::create("Surname", "Surname"), TextField::create("CompanyName", "Company Name"), TextField::create("AddressLine1", "Address Line 1"), TextField::create("AddressLine2", "Address Line 2"), TextField::create("City", "Town/City"), TextField::create("StateCounty", "State/County"), TextField::create("Postcode", "Zip/Postcode"), CountryDropdownField::create("Country", "Country"), TextField::create("PhoneNumber", "Contact Number"))));
     return $fields;
 }
 public function __construct($controller, $name = "BillingDetailsForm")
 {
     $personal_fields = CompositeField::create(HeaderField::create('PersonalHeader', _t('Commerce.PersonalDetails', 'Personal Details'), 3), TextField::create('FirstName', _t('Commerce.FirstName', 'First Name(s)') . '*'), TextField::create('Surname', _t('Commerce.Surname', 'Surname') . '*'), TextField::create("Company", _t('Commerce.Company', "Company")), EmailField::create('Email', _t('Commerce.Email', 'Email') . '*'), TextField::create('PhoneNumber', _t('Commerce.Phone', 'Phone Number')))->setName("PersonalFields")->addExtraClass('unit')->addExtraClass('size1of2')->addExtraClass('unit-50');
     $address_fields = CompositeField::create(HeaderField::create('AddressHeader', _t('Commerce.Address', 'Address'), 3), TextField::create('Address1', _t('Commerce.Address1', 'Address Line 1') . '*'), TextField::create('Address2', _t('Commerce.Address2', 'Address Line 2')), TextField::create('City', _t('Commerce.City', 'City') . '*'), TextField::create('PostCode', _t('Commerce.PostCode', 'Post Code') . '*'), CountryDropdownField::create('Country', _t('Commerce.Country', 'Country') . '*', null, 'GB')->setAttribute("class", 'countrydropdown dropdown btn'))->setName("AddressFields")->addExtraClass('unit')->addExtraClass('size1of2')->addExtraClass('unit-50');
     $fields = FieldList::create(CompositeField::create($personal_fields, $address_fields)->setName("BillingFields")->addExtraClass('line')->addExtraClass('units-row'));
     // Add a save address for later checkbox if a user is logged in
     if (Member::currentUserID()) {
         $fields->add(CompositeField::create(CheckboxField::create("SaveAddress", _t('Commerce.SaveAddress', 'Save this address for later')))->setName("SaveAddressHolder")->addExtraClass('line')->addExtraClass('units-row'));
     }
     $back_url = Controller::join_links(BASE_URL, ShoppingCart::config()->url_segment);
     $actions = FieldList::create(LiteralField::create('BackButton', '<a href="' . $back_url . '" class="btn btn-red commerce-action-back">' . _t('Commerce.Back', 'Back') . '</a>'), FormAction::create('doSetDelivery', _t('Commerce.SetDeliveryAddress', 'Deliver to another address'))->addExtraClass('btn')->addExtraClass('commerce-action-next'), FormAction::create('doContinue', _t('Commerce.DeliverThisAddress', 'Deliver to this address'))->addExtraClass('btn')->addExtraClass('commerce-action-next')->addExtraClass('btn-green'));
     $validator = new RequiredFields('FirstName', 'Surname', 'Address1', 'City', 'PostCode', 'Country', 'Email');
     parent::__construct($controller, $name, $fields, $actions, $validator);
 }
 public function __construct($controller, $name, $type)
 {
     /* Fields */
     $fields = FieldList::create(DropdownField::create("AddressType", "Address Type", array("1" => "Residential", "2" => "Commercial")), TextField::create("FirstName", "First Name"), TextField::create("Surname", "Surname"), TextField::create("CompanyName", "Company Name"), TextField::create("AddressLine1", "Address Line 1"), TextField::create("AddressLine2", "Address Line 2"), TextField::create("City", "Town/City"), TextField::create("StateCounty", "State/County"), TextField::create("Postcode", "Zip/Postcode"), CountryDropdownField::create("Country", "Country"), TextField::create("PhoneNumber", "Contact Number"), HiddenField::create("Type", "Type", $type));
     /* Actions */
     $actions = FieldList::create(CompositeField::create(FormAction::create('newaddress', 'Use Address &amp; Continue')));
     /* Required Fields */
     $required = new RequiredFields(array("FirstName", "Surname", "AddressLine1", "City", "StateCounty", "Country", "Postcode", "AddressType", "PhoneNumber"));
     /*
      * Now we create the actual form with our fields and actions defined 
      * within this class.
      */
     return parent::__construct($controller, $name, $fields, $actions, $required);
 }
 public function __construct($controller, $name = "DeliveryDetailsForm")
 {
     $personal_fields = CompositeField::create(HeaderField::create('PersonalHeader', _t('Checkout.PersonalDetails', 'Personal Details'), 3), TextField::create('DeliveryCompany', _t('Checkout.Company', 'Company'))->setRightTitle(_t("Checkout.Optional", "Optional")), TextField::create('DeliveryFirstnames', _t('Checkout.FirstName', 'First Name(s)')), TextField::create('DeliverySurname', _t('Checkout.Surname', 'Surname')))->setName("PersonalFields")->addExtraClass('unit')->addExtraClass('size1of2')->addExtraClass('unit-50');
     $address_fields = CompositeField::create(HeaderField::create('AddressHeader', _t('Checkout.Address', 'Address'), 3), TextField::create('DeliveryAddress1', _t('Checkout.Address1', 'Address Line 1')), TextField::create('DeliveryAddress2', _t('Checkout.Address2', 'Address Line 2'))->setRightTitle(_t("Checkout.Optional", "Optional")), TextField::create('DeliveryCity', _t('Checkout.City', 'City')), TextField::create('DeliveryPostCode', _t('Checkout.PostCode', 'Post Code')), CountryDropdownField::create('DeliveryCountry', _t('Checkout.Country', 'Country')))->setName("AddressFields")->addExtraClass('unit')->addExtraClass('size1of2')->addExtraClass('unit-50');
     $fields = FieldList::create(CompositeField::create($personal_fields, $address_fields)->setName("DeliveryFields")->addExtraClass('line')->addExtraClass('units-row'));
     // Add a save address for later checkbox if a user is logged in
     if (Member::currentUserID()) {
         $member = Member::currentUser();
         $fields->add(CompositeField::create(CheckboxField::create("SaveAddress", _t('Checkout.SaveAddress', 'Save this address for later')))->setName("SaveAddressHolder")->addExtraClass('line')->addExtraClass('units-row'));
     }
     $back_url = $controller->Link();
     $actions = FieldList::create(LiteralField::create('BackButton', '<a href="' . $back_url . '" class="btn btn-red checkout-action-back">' . _t('Checkout.Back', 'Back') . '</a>'), FormAction::create('doContinue', _t('Checkout.PostageDetails', 'Select Postage'))->addExtraClass('btn')->addExtraClass('checkout-action-next')->addExtraClass('btn-green'));
     $validator = new RequiredFields('DeliveryFirstnames', 'DeliverySurname', 'DeliveryAddress1', 'DeliveryCity', 'DeliveryPostCode', 'DeliveryCountry');
     parent::__construct($controller, $name, $fields, $actions, $validator);
 }
 public function __construct($controller, $name = "DeliveryDetailsForm")
 {
     $personal_fields = CompositeField::create(HeaderField::create('PersonalHeader', _t('Checkout.PersonalDetails', 'Personal Details'), 3), TextField::create('DeliveryCompany', _t('Checkout.Company', 'Company'))->setRightTitle(_t("Checkout.Optional", "Optional")), TextField::create('DeliveryFirstnames', _t('Checkout.FirstName', 'First Name(s)')), TextField::create('DeliverySurname', _t('Checkout.Surname', 'Surname')))->setName("PersonalFields");
     $address_fields = CompositeField::create(HeaderField::create('AddressHeader', _t('Checkout.Address', 'Address'), 3), TextField::create('DeliveryAddress1', _t('Checkout.Address1', 'Address Line 1')), TextField::create('DeliveryAddress2', _t('Checkout.Address2', 'Address Line 2'))->setRightTitle(_t("Checkout.Optional", "Optional")), TextField::create('DeliveryCity', _t('Checkout.City', 'City')), TextField::create('DeliveryPostCode', _t('Checkout.PostCode', 'Post Code')), CountryDropdownField::create('DeliveryCountry', _t('Checkout.Country', 'Country')))->setName("AddressFields");
     $fields = FieldList::create(CompositeField::create($personal_fields, $address_fields)->setName("DeliveryFields")->setColumnCount(2));
     // Add a save address for later checkbox if a user is logged in
     if (Member::currentUserID()) {
         $member = Member::currentUser();
         $fields->add(CompositeField::create(CheckboxField::create("SaveAddress", _t('Checkout.SaveAddress', 'Save this address for later')))->setName("SaveAddressHolder"));
     }
     $actions = FieldList::create(FormAction::create('doContinue', _t('Checkout.PostageDetails', 'Select Postage'))->addExtraClass('checkout-action-next'));
     $validator = new RequiredFields('DeliveryFirstnames', 'DeliverySurname', 'DeliveryAddress1', 'DeliveryCity', 'DeliveryPostCode', 'DeliveryCountry');
     parent::__construct($controller, $name, $fields, $actions, $validator);
     $this->setTemplate($this->ClassName);
 }
 public function __construct($controller, $name = "BillingDetailsForm")
 {
     $personal_fields = CompositeField::create(HeaderField::create('PersonalHeader', _t('Checkout.PersonalDetails', 'Personal Details'), 3), TextField::create('FirstName', _t('Checkout.FirstName', 'First Name(s)')), TextField::create('Surname', _t('Checkout.Surname', 'Surname')), TextField::create("Company", _t('Checkout.Company', "Company"))->setRightTitle(_t("Checkout.Optional", "Optional")), EmailField::create('Email', _t('Checkout.Email', 'Email')), TextField::create('PhoneNumber', _t('Checkout.Phone', 'Phone Number')))->setName("PersonalFields");
     $address_fields = CompositeField::create(HeaderField::create('AddressHeader', _t('Checkout.Address', 'Address'), 3), TextField::create('Address1', _t('Checkout.Address1', 'Address Line 1')), TextField::create('Address2', _t('Checkout.Address2', 'Address Line 2'))->setRightTitle(_t("Checkout.Optional", "Optional")), TextField::create('City', _t('Checkout.City', 'City')), TextField::create('PostCode', _t('Checkout.PostCode', 'Post Code')), CountryDropdownField::create('Country', _t('Checkout.Country', 'Country'), null, 'GB'))->setName("AddressFields");
     $fields = FieldList::create($billing_fields = CompositeField::create($personal_fields, $address_fields)->setName("BillingFields")->setColumnCount(2));
     // Add a save address for later checkbox if a user is logged in
     if (Member::currentUserID()) {
         $fields->add(CompositeField::create(CheckboxField::create("SaveAddress", _t('Checkout.SaveAddress', 'Save this address for later')))->setName("SaveAddressHolder"));
     }
     $actions = FieldList::create();
     if (ShoppingCart::get()->isCollection()) {
         $actions->add(FormAction::create('doSetDelivery', _t('Checkout.UseTheseDetails', 'Use these details'))->addExtraClass('checkout-action-next'));
     } else {
         $actions->add(FormAction::create('doSetDelivery', _t('Checkout.SetDeliveryAddress', 'Deliver to another address'))->addExtraClass('checkout-action-next'));
         $actions->add(FormAction::create('doContinue', _t('Checkout.DeliverThisAddress', 'Deliver to this address'))->addExtraClass('checkout-action-next'));
     }
     $validator = new RequiredFields('FirstName', 'Surname', 'Address1', 'City', 'PostCode', 'Country', 'Email', 'PhoneNumber');
     parent::__construct($controller, $name, $fields, $actions, $validator);
     $this->setTemplate($this->ClassName);
 }
 /**
  * @param  $field_name
  * @return mixed
  */
 public function getFieldForName($field_name)
 {
     $field_title = preg_replace('/(?<=\\w)(?=[A-Z])/', ' $1', $field_name);
     switch ($field_name) {
         case 'Country':
             $field = CountryDropdownField::create($field_name, $field_title);
             break;
         case 'State':
             $field = class_exists('USStateDropdownField') ? USStateDropdownField::create($field_name, $field_title) : TextField::create($field_name, $field_title);
             break;
         case 'Email':
             $field = EmailField::create($field_name, $field_title);
             break;
         case 'MetaType':
             $field = DropdownField::create('MetaType', 'Meta Type', $this->config()->flexiaddress_metatype);
             break;
         default:
             $field = TextField::create($field_name, $field_title);
             break;
     }
     return $field;
 }
 /**
  * Constructs a FieldList for use in the CMSForm.
  *
  * @return FieldList
  */
 public function construct_cms_fields()
 {
     //Create the FieldList and push the Root TabSet on to it.
     $fields = FieldList::create($root = TabSet::create('Root', Tabset::create("Settings", Tabset::create("General", Tab::create("StoreSettings", HeaderField::create("Maintenance Mode"), CompositeField::create(DropdownField::create("StoreSettings_StoreAvailable", "Store Status", array("1" => "Live", "2" => "Down for Maintenance (show the below message)")), TextareaField::create("StoreSettings_StoreAvailableMessage", "Maintenance Message")->setRightTitle("The message to display to visitors whilst your store is in maintenance mode.")), HeaderField::create("Store Details"), CompositeField::create(TextField::create("StoreSettings_StoreName", "Store Name")->setRightTitle("i.e. Steve's Shoe Shop."), TextareaField::create("StoreSettings_StoreAddress", "Store Address")->setRightTitle("<strong>Example</strong><br />123 ACME Drive<br />Enfield<br />London</br />EN1 1YQ"), CountryDropdownField::create("StoreSettings_StoreCountry", "Store Country")), HeaderField::create("Product Measurements"), CompositeField::create(DropdownField::create("StoreSettings_ProductWeight", "Product Weight", array("Pounds" => "Pounds", "Ounces" => "Ounces", "Grams" => "Grams", "Kilograms" => "Kilograms", "Tonns" => "Tonns"))->setRightTitle("Select the weight measurement you wish to use in your store."), DropdownField::create("StoreSettings_ProductDimensions", "Product Dimensions", array("Inches" => "Inches", "Millimetres" => "Millimetres", "Centimetres" => "Centimetres"))->setRightTitle("Select the width, height and length measurement you wish to use in your store.")), HeaderField::create("SSL"), CompositeField::create(LiteralField::create("SSL_LiteralField", "<div class=\"literal-field literal-field-noborder\">\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t<div class=\"message warning\">\n\t\t\t\t\t\t\t\t\t\t\t<strong>IMPORTANT:</strong><br />\n\t\t\t\t\t\t\t\t\t\t\tIn order to protect your customers personally identifiable information it is\n\t\t\t\t\t\t\t\t\t\t\tstrongly recommended that you consider installing an SSL certificate for your website.\n\t\t\t\t\t\t\t\t\t\t\t<br />If you are unsure on how to do this please reach out to the party responsible\n\t\t\t\t\t\t\t\t\t\t\tfor this website. \n\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\tEnabling the option below will ensure all communications between third-party providers\n\t\t\t\t\t\t\t\t\t\tare transmitted over the https:// protocol.\n\t\t\t\t\t\t\t\t\t</div>"), CheckboxField::create("StoreSettings_SSLToggle", "Yes, I have SSL enabled."))), Tab::create("DisplaySettings", HeaderField::create("General Display Settings"), CompositeField::create(NumericField::create("DisplaySettings_FeaturedProducts", "Featured Products")->setRightTitle("Enter the number of products you wish to display in the Featured Products panels."), NumericField::create("DisplaySettings_NewProducts", "New Products")->setRightTitle("Enter the number of products you wish to display in the New Products panels."), DropdownField::create("DisplaySettings_CartQuantity", "Cart Quantity Selection", array("1" => "Dropdown", "2" => "Textbox"))->setRightTitle("Select how you wish the quantity selector to be shown on the product pages.")), HeaderField::create("Product Display Settings"), CompositeField::create(CheckboxField::create("DisplaySettings_ShowPrice", "Show product prices im my store."), CheckboxField::create("DisplaySettings_ShowSKU", "Show product SKUs in my store."), CheckboxField::create("DisplaySettings_ShowWeight", "Show product weights in my store."), CheckboxField::create("DisplaySettings_ShowDimensions", "Show product dimensions in my store."), DropdownField::create("DisplaySettings_ProductSort", "Default Product Sort", array("Title ASC" => "Product Name Ascending", "Title DESC" => "Product Name Descending", "SalePrice ASC, RegularPrice ASC" => "Price Lowest to Highest", "SalePrice DESC, RegularPrice DESC" => "Price Highest to Lowest", "Created ASC" => "Oldest First", "Created DESC" => "Newest First"))), HeaderField::create("Product Photo Display Settings"), CompositeField::create(LiteralField::create("ProductPagePhoto_LiteralField", "<div class=\"literal-field\">\n\t\t\t\t\t\t\t\t\t\t<strong>Product Page Photo Size</strong><br />\n\t\t\t\t\t\t\t\t\t\tEnter the width and height to use for the main photo on a product page.\n\t\t\t\t\t\t\t\t\t</div>"), FieldGroup::create(NumericField::create("DisplaySettings_ProductPagePhotoWidth", "Width (pixels)"), NumericField::create("DisplaySettings_ProductPagePhotoHeight", "Width (pixels)")), LiteralField::create("ProductThumbnailPhoto_LiteralField", "<div class=\"literal-field\">\n\t\t\t\t\t\t\t\t\t\t<strong>Product Thumbnail Photo Size</strong><br />\n\t\t\t\t\t\t\t\t\t\tEnter the width and height to use for product thumbnails throughout the store.\n\t\t\t\t\t\t\t\t\t</div>"), FieldGroup::create(NumericField::create("DisplaySettings_ProductThumbnailPhotoWidth", "Width (pixels)"), NumericField::create("DisplaySettings_ProductThumbnailPhotoHeight", "Height (pixels)")), LiteralField::create("ProductEnlargedPhoto_LiteralField", "<div class=\"literal-field\">\n\t\t\t\t\t\t\t\t\t\t<strong>Enlarged Photo Size</strong><br />\n\t\t\t\t\t\t\t\t\t\tEnter the width and height to use for enlarged photos. Users will see this if they click\n\t\t\t\t\t\t\t\t\t\tto see the larger version of a product photo from a product page.\n\t\t\t\t\t\t\t\t\t</div>"), FieldGroup::create(NumericField::create("DisplaySettings_ProductEnlargedPhotoWidth", "Width (pixels)"), NumericField::create("DisplaySettings_ProductEnlargedPhotoHeight", "Height (pixels)"))))), Tabset::create("Orders", Tab::create("CheckoutSettings", HeaderField::create("Initial Order Status"), CompositeField::create(DropdownField::create("CheckoutSettings_InitialStatus", "Status", DataObject::get("Order_Statuses", "", "Title ASC")->map('ID', 'Title'))->setRightTitle("Select the status you wish all new orders to be set to.")), HeaderField::create("Guest Checkout"), CompositeField::create(CheckboxField::create("CheckoutSettings_GuestCheckout", "Allow customers to checkout as a guest without the need for an account."), CheckboxField::create("CheckoutSettings_GuestCheckoutAccount", "Create an account for customers if they checkout as a guest (if they do not already have one)")), HeaderField::create("Order Comments"), CompositeField::create(CheckboxField::create("CheckoutSettings_OrderComments", "Allow customers to provide a comment with their orders.")), HeaderField::create("Terms &amp; Conditions"), CompositeField::create(CheckboxField::create("CheckoutSettings_TermsAndConditions", "I require my customers to have agreed to terms and conditions before they can place an order."), TreeDropdownField::create("CheckoutSettings_TermsAndConditionsSiteTree", "Terms &amp; Conditions Page", "SiteTree"))), Tab::create("Order Statuses", HeaderField::create("Custom Order Statuses"), CompositeField::create(LiteralField::create("CustomOrderStatus_LiteralField", "<div class=\"literal-field\">\n\t\t\t\t\t\t\t\t\t\tThis section allows you to specify custom order statuses where those out of the box\n\t\t\t\t\t\t\t\t\t\tdo not otherwise match your businesses requirements.\n\t\t\t\t\t\t\t\t\t</div>"), GridField::create("CustomOrderStatus", "", DataObject::get("Order_Statuses", "(0=SystemCreated)", "Title ASC"), GridFieldConfig_RecordEditor::create())), HeaderField::create("Default Order Statuses"), CompositeField::create(LiteralField::create("DefaultOrderStatus_LiteralField", "<div class=\"literal-field\">\n\t\t\t\t\t\t\t\t\t\tThis section displays the default order statuses that are used throughout the store. Feel free\n\t\t\t\t\t\t\t\t\t\tto alter their Display Name and Descriptions to suit the needs of your business.\n\t\t\t\t\t\t\t\t\t</div>"), GridField::create("DefaultOrderStatus", "", DataObject::get("Order_Statuses", "(1=SystemCreated)", "Title ASC"), GridFieldConfig_RecordEditor::create()->removeComponentsByType("GridFieldAddNewButton")->removeComponentsByType("GridFieldDeleteAction")))), Tab::create("EmailNotifications", HeaderField::create("Send store emails from"), CompositeField::create(EmailField::create("EmailNotification_SendEmailsFrom", "From Email Address")->setRightTitle("\n\t\t\t\t\t\t\t\t\tThis is the address that is used in the 'From' section of all automatically generated emails.<br />\n\t\t\t\t\t\t\t\t\t<strong>SMTP Users:</strong> If you are using a SilverStripe SMTP module it is strongly recommended\n\t\t\t\t\t\t\t\t\tyou set this value to that of the authenticated SMTP email address.")), HeaderField::create("New order notifications"), CompositeField::create(EmailField::create("EmailNotification_AdminNewOrder", "Admin Notification Email")->setRightTitle("When the store receives a new order send a notification to the above address.")), HeaderField::create("Send the customer an email when"), CompositeField::create(CheckboxField::create("EmailNotification_AccountCreated", "They create an account."), CheckboxField::create("EmailNotification_OrderPlaced", "They place an order with my store.")), HeaderField::create("Send the customer an email when their order status changes to"), CompositeField::create(CheckboxSetField::create("EmailNotification_OrderStatuses", "Pick your desired statuses", DataObject::get("Order_Statuses", "", "Title ASC")->map('ID', 'Title'))))), Tab::create("Stock", HeaderField::create("Stock Management"), CompositeField::create(LiteralField::create("StockManagement_LiteralField", "<div class=\"literal-field\">\n\t\t\t\t\t\t\t\t\t<strong>What is Stock Management?</strong><br />\n\t\t\t\t\t\t\t\t\tStock management is designed to keep tabs on your stock levels. If enabled, stock levels will be\n\t\t\t\t\t\t\t\t\tmanaged by the store and automatically decremented upon receiving a successful order.<br />\n\t\t\t\t\t\t\t\t\tIt will also prevent customers from placing an order for a product if it is deemed to\n\t\t\t\t\t\t\t\t\tbe out of stock.\n\t\t\t\t\t\t\t\t</div>"), CheckboxField::create("Stock_StockManagement", "Enable stock control in my store.")), HeaderField::create("Pending Orders"), CompositeField::create(LiteralField::create("PendingOrders_LiteralField", "<div class=\"literal-field\">\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\tEnter the number of minutes that stock allocated to unpaid orders will be held before the \n\t\t\t\t\t\t\t\t\tassociated order is cancelled and held stock is made available to other customers.\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t</div>"), FieldGroup::create(NumericField::create("Stock_PendingOrdersFreezeStock", ""))), HeaderField::create("Stock Levels"), CompositeField::create(FieldGroup::create(NumericField::create("Stock_LowStockThreshold", "Low Stock Threshold")->setRightTitle("The stock level considered as low."), NumericField::create("Stock_OutOfStockThreshold", "Out of Stock Threshold")->setRightTitle("The stock level considered as out of stock."), TextField::create("Stock_OutofStockMessage", "Out of Stock Message")->setRightTitle("The message to display when a product is out of stock.")), DropdownField::create("Stock_ProductOutOfStock", "Product Out of Stock", array("1" => "Completely hide the product from my store", "2" => "Hide the product but allow the product page to be accessed from its URL", "3" => "Do not make any changes"))->setRightTitle("Select what you wish to happen when a product is out of stock."), DropdownField::create("Stock_StockLevelDisplay", "Stock Level Display", array("1" => "Always show stock levels", "2" => "Show stock levels after the product drops below the low stock threshold", "3" => "Never show stock levels"))->setRightTitle("Select how you would like stock levels to appear in your store."))), Tab::create("Couriers", HeaderField::create("Couriers"), CompositeField::create(GridField::create("CourierSettings", "", DataObject::get("Courier", "", "Title ASC"), GridFieldConfig_RecordEditor::create()->removeComponentsByType("GridFieldAddNewButton")->removeComponentsByType("GridFieldDeleteAction")))), Tab::create("Gateways", HeaderField::create("Gateways"), CompositeField::create(GridField::create("GatewaySettings", "", DataObject::get("Gateway", "", "Title ASC"), GridFieldConfig_RecordEditor::create()->removeComponentsByType("GridFieldAddNewButton")->removeComponentsByType("GridFieldDeleteAction")))), Tab::create("Currency", HeaderField::create("Accepted Currencies"), CompositeField::create(LiteralField::create("CurrencySettings_LiteralField", "<div class=\"literal-field\">\n\t\t\t\t\t\t\t\t\tYou can define additional currencies in this section. Customers will be shown prices in their\n\t\t\t\t\t\t\t\t\tselected currency throughout the store but will transact in your local currency.\n\t\t\t\t\t\t\t\t</div>"), GridField::create("CurrencySettings_AcceptedCurrencies", "", DataObject::get("StoreCurrency", "(0=SystemCreated)", "Title ASC"), GridFieldConfig_RecordEditor::create())), HeaderField::create("Local (Default) Currency"), CompositeField::create(LiteralField::create("CurrencySettings_LiteralField", "<div class=\"literal-field\">\n\t\t\t\t\t\t\t\t\tConfigure your store's local (default) currency in this section.\n\t\t\t\t\t\t\t\t</div>"), GridField::create("CurrencySettings_LocalCurrency", "", DataObject::get("StoreCurrency", "(1=SystemCreated)", "Title ASC"), GridFieldConfig_RecordEditor::create()->removeComponentsByType("GridFieldAddNewButton")->removeComponentsByType("GridFieldDeleteAction")))), Tabset::create("Tax", Tab::create("TaxSettings", HeaderField::create("Tax Settings"), CompositeField::create(DropdownField::create("TaxSettings_InclusiveExclusive", "Product Prices Are", array("1" => "Inclusive of Tax", "2" => "Exclusive of Tax")), DropdownField::create("TaxSettings_ShippingInclusiveExclusive", "Shipping Prices Are", array("1" => "Inclusive of Tax", "2" => "Exclusive of Tax")), DropdownField::create("TaxSettings_CalculateUsing", "Calculate Tax Using", array("1" => "Billing Address", "2" => "Shipping Address", "3" => "Store Address")))), Tab::create("TaxClasses", HeaderField::create("Other Tax Classes"), CompositeField::create(LiteralField::create("CurrencySettings_LiteralField", "<div class=\"literal-field\">\n\t\t\t\t\t\t\t\t\t\tA Tax class allows you to define tax categories.\n\t\t\t\t\t\t\t\t\t</div>"), GridField::create("TaxSettings_ClassesOther", "", DataObject::get("TaxClasses", "(0=SystemCreated)", "ID ASC"), GridFieldConfig_RecordEditor::create())), HeaderField::create("Default Tax Classes"), CompositeField::create(LiteralField::create("CurrencySettings_LiteralField", "<div class=\"literal-field\">\n\t\t\t\t\t\t\t\t\t\tThese are the default tax classes.\n\t\t\t\t\t\t\t\t\t</div>"), GridField::create("TaxSettings_ClassesDefault", "", DataObject::get("TaxClasses", "(1=SystemCreated)", "Title ASC"), GridFieldConfig_RecordEditor::create()->removeComponentsByType("GridFieldAddNewButton")->removeComponentsByType("GridFieldDeleteAction")))), Tab::create("TaxZones", HeaderField::create("Other Tax Zones"), CompositeField::create(LiteralField::create("CurrencySettings_LiteralField", "<div class=\"literal-field\">\n\t\t\t\t\t\t\t\t\t\tA Tax Zone allows you to define Tax rules on a country by country basis.\n\t\t\t\t\t\t\t\t\t</div>"), GridField::create("TaxSettings_Zones", "", DataObject::get("TaxZones", "(0=SystemCreated)", "Title ASC"), GridFieldConfig_RecordEditor::create())), HeaderField::create("Default Tax Zone"), CompositeField::create(LiteralField::create("CurrencySettings_LiteralField", "<div class=\"literal-field\">\n\t\t\t\t\t\t\t\t\t\tThis is the default tax zone applies where no zone exists for a customers' country.\n\t\t\t\t\t\t\t\t\t</div>"), GridField::create("TaxSettings_ZonesDefault", "", DataObject::get("TaxZones", "(1=SystemCreated)", "Title ASC"), GridFieldConfig_RecordEditor::create()->removeComponentsByType("GridFieldAddNewButton")->removeComponentsByType("GridFieldDeleteAction"))))), Tab::create("Reviews", HeaderField::create("Product Reviews"), CompositeField::create(CheckboxField::create("ProductReviewSettings_EnableReviews", "Enable product reviews in my store."), CheckboxField::create("ProductReviewSettings_ApprovedPurchaserOnly", "Require a customer to have purchased an item before making a review."), CheckboxField::create("ProductReviewSettings_AdminApproval", "Require admin approval before reviews are made visible."))))), HiddenField::create('ID', false, 0));
     //Tab nav in CMS is rendered through separate template
     $root->setTemplate('CMSTabSet');
     return $fields;
 }
 /**
  * Form responsible for estimating shipping based on location and
  * postal code
  *
  * @return Form
  */
 public function PostageForm()
 {
     if (!Checkout::config()->simple_checkout) {
         $available_postage = Session::get("Checkout.AvailablePostage");
         // Setup form
         $form = Form::create($this, 'PostageForm', $fields = new FieldList(CountryDropdownField::create('Country', _t('Checkout.Country', 'Country')), TextField::create("ZipCode", _t('Checkout.ZipCode', "Zip/Postal Code"))), $actions = new FieldList(FormAction::create("doSetPostage", _t('Checkout.Search', "Search"))->addExtraClass('btn')->addExtraClass('btn btn-green btn-success')), $required = RequiredFields::create(array("Country", "ZipCode")))->addExtraClass('forms')->addExtraClass('forms-inline')->setLegend(_t("Checkout.EstimateShipping", "Estimate Shipping"));
         // If we have stipulated a search, then see if we have any results
         // otherwise load empty fieldsets
         if ($available_postage && $available_postage->exists()) {
             // Loop through all postage areas and generate a new list
             $postage_array = array();
             foreach ($available_postage as $area) {
                 $area_currency = new Currency("Cost");
                 $area_currency->setValue($area->Cost);
                 $postage_array[$area->ID] = $area->Title . " (" . $area_currency->Nice() . ")";
             }
             $fields->add(OptionsetField::create("PostageID", _t('Checkout.SelectPostage', "Select Postage"), $postage_array));
             $actions->dataFieldByName("action_doSetPostage")->setTitle(_t('Checkout.Update', "Update"));
         }
         // Check if the form has been re-posted and load data
         $data = Session::get("Form.{$form->FormName()}.data");
         if (is_array($data)) {
             $form->loadDataFrom($data);
         }
         // Check if the postage area has been set, if so, Set Postage ID
         $data = array();
         $data["PostageID"] = Session::get("Checkout.PostageID");
         if (is_array($data)) {
             $form->loadDataFrom($data);
         }
         // Extension call
         $this->extend("updatePostageForm", $form);
         return $form;
     }
 }
 public function getFormField()
 {
     $field = CountryDropdownField::create($this->Name, $this->EscapedTitle)->setFieldHolderTemplate('UserFormsField_holder')->setTemplate('UserFormsDropdownField');
     $this->doUpdateFormField($field);
     return $field;
 }
 /**
  * Form responsible for estimating shipping based on location and
  * postal code
  *
  * @return Form
  */
 public function PostageForm()
 {
     $available_postage = Session::get("Commerce.AvailablePostage");
     // Setup default postage fields
     $country_select = CompositeField::create(CountryDropdownField::create('Country', _t('Commerce.Country', 'Country'))->setAttribute("class", 'countrydropdown dropdown btn'), TextField::create("ZipCode", _t('Commerce.ZipCode', "Zip/Postal Code")))->addExtraClass("size1of2")->addExtraClass("unit")->addExtraClass("unit-50");
     // If we have stipulated a search, then see if we have any results
     // otherwise load empty fieldsets
     if ($available_postage) {
         $search_text = _t('Commerce.Update', "Update");
         // Loop through all postage areas and generate a new list
         $postage_array = array();
         foreach ($available_postage as $area) {
             $area_currency = new Currency("Cost");
             $area_currency->setValue($area->Cost);
             $postage_array[$area->ID] = $area->Title . " (" . $area_currency->Nice() . ")";
         }
         $postage_select = CompositeField::create(OptionsetField::create("PostageID", _t('Commerce.SelectPostage', "Select Postage"), $postage_array))->addExtraClass("size1of2")->addExtraClass("unit")->addExtraClass("unit-50");
         $confirm_action = CompositeField::create(FormAction::create("doSavePostage", _t('Commerce.Confirm', "Confirm"))->addExtraClass('btn')->addExtraClass('btn-green'))->addExtraClass("size1of2")->addExtraClass("unit")->addExtraClass("unit-50");
     } else {
         $search_text = _t('Commerce.Search', "Search");
         $postage_select = CompositeField::create()->addExtraClass("size1of2")->addExtraClass("unit")->addExtraClass("unit-50");
         $confirm_action = CompositeField::create()->addExtraClass("size1of2")->addExtraClass("unit")->addExtraClass("unit-50");
     }
     // Set search field
     $search_action = CompositeField::create(FormAction::create("doGetPostage", $search_text)->addExtraClass('btn'))->addExtraClass("size1of2")->addExtraClass("unit")->addExtraClass("unit-50");
     // Setup fields and actions
     $fields = new FieldList(CompositeField::create($country_select, $postage_select)->addExtraClass("line")->addExtraClass("units-row-end"));
     $actions = new FieldList(CompositeField::create($search_action, $confirm_action)->addExtraClass("line")->addExtraClass("units-row-end"));
     $required = RequiredFields::create(array("Country", "ZipCode"));
     $form = Form::create($this, 'PostageForm', $fields, $actions, $required)->addExtraClass('forms')->addExtraClass('forms-columnar');
     // Check if the form has been re-posted and load data
     $data = Session::get("Form.{$form->FormName()}.data");
     if (is_array($data)) {
         $form->loadDataFrom($data);
     }
     // Check if the postage area has been set, if so, Set Postage ID
     $data = array();
     $data["PostageID"] = Session::get("Commerce.PostageID");
     if (is_array($data)) {
         $form->loadDataFrom($data);
     }
     // Extension call
     $this->extend("updatePostageForm", $form);
     return $form;
 }
Esempio n. 16
0
 public function getCMSFields()
 {
     $member = Member::currentUser();
     $existing_customer = $this->config()->existing_customer_class;
     // Manually inject HTML for totals as Silverstripe refuses to
     // render Currency.Nice any other way.
     $subtotal_html = '<div id="SubTotal" class="field readonly">';
     $subtotal_html .= '<label class="left" for="Form_ItemEditForm_SubTotal">';
     $subtotal_html .= _t("Orders.SubTotal", "Sub Total");
     $subtotal_html .= '</label>';
     $subtotal_html .= '<div class="middleColumn"><span id="Form_ItemEditForm_SubTotal" class="readonly">';
     $subtotal_html .= $this->SubTotal->Nice();
     $subtotal_html .= '</span></div></div>';
     $discount_html = '<div id="Discount" class="field readonly">';
     $discount_html .= '<label class="left" for="Form_ItemEditForm_Discount">';
     $discount_html .= _t("Orders.Discount", "Discount");
     $discount_html .= '</label>';
     $discount_html .= '<div class="middleColumn"><span id="Form_ItemEditForm_Discount" class="readonly">';
     $discount_html .= $this->dbObject("DiscountAmount")->Nice();
     $discount_html .= '</span></div></div>';
     $postage_html = '<div id="Postage" class="field readonly">';
     $postage_html .= '<label class="left" for="Form_ItemEditForm_Postage">';
     $postage_html .= _t("Orders.Postage", "Postage");
     $postage_html .= '</label>';
     $postage_html .= '<div class="middleColumn"><span id="Form_ItemEditForm_Postage" class="readonly">';
     $postage_html .= $this->Postage->Nice();
     $postage_html .= '</span></div></div>';
     $tax_html = '<div id="TaxTotal" class="field readonly">';
     $tax_html .= '<label class="left" for="Form_ItemEditForm_TaxTotal">';
     $tax_html .= _t("Orders.Tax", "Tax");
     $tax_html .= '</label>';
     $tax_html .= '<div class="middleColumn"><span id="Form_ItemEditForm_TaxTotal" class="readonly">';
     $tax_html .= $this->TaxTotal->Nice();
     $tax_html .= '</span></div></div>';
     $total_html = '<div id="Total" class="field readonly">';
     $total_html .= '<label class="left" for="Form_ItemEditForm_Total">';
     $total_html .= _t("Orders.Total", "Total");
     $total_html .= '</label>';
     $total_html .= '<div class="middleColumn"><span id="Form_ItemEditForm_Total" class="readonly">';
     $total_html .= $this->Total->Nice();
     $total_html .= '</span></div></div>';
     $fields = new FieldList($tab_root = new TabSet("Root", $tab_main = new Tab('Main', new OrderItemGridField("Items", "", $this->Items(), $config = GridFieldConfig::create()->addComponents(new GridFieldButtonRow('before'), new GridFieldTitleHeader(), new GridFieldEditableColumns(), new GridFieldDeleteAction(), new GridFieldAddOrderItem())), new HeaderField("PostageDetailsHeader", _t("Orders.PostageDetails", "Postage Details")), TextField::create("PostageType"), TextField::create("PostageCost"), TextField::create("PostageTax"), new HeaderField("DiscountDetailsHeader", _t("Orders.DiscountDetails", "Discount")), TextField::create("Discount"), TextField::create("DiscountAmount"), OrderSidebar::create(TextField::create('Status'), DropdownField::create('Action', null, $this->config()->actions), ReadonlyField::create("QuoteNumber", "#")->setValue($this->ID), ReadonlyField::create("Created"), LiteralField::create("SubTotal", $subtotal_html), LiteralField::create("Discount", $discount_html), LiteralField::create("Postage", $postage_html), LiteralField::create("TaxTotal", $tax_html), LiteralField::create("Total", $total_html), TextField::create('PaymentProvider'), TextField::create('PaymentNo'))->setTitle("Details")), $tab_customer = new Tab('Customer', HeaderField::create("BillingDetailsHeader", _t("Orders.BillingDetails", "Customer Details")), TextField::create("Company"), TextField::create("FirstName"), TextField::create("Surname"), TextField::create("Address1"), TextField::create("Address2"), TextField::create("City"), TextField::create("PostCode"), CountryDropdownField::create("Country"), TextField::create("Email"), TextField::create("PhoneNumber")), $tab_delivery = new Tab('Delivery', HeaderField::create("DeliveryDetailsHeader", _t("Orders.DeliveryDetails", "Delivery Details")), TextField::create("DeliveryCompany"), TextField::create("DeliveryFirstnames"), TextField::create("DeliverySurname"), TextField::create("DeliveryAddress1"), TextField::create("DeliveryAddress2"), TextField::create("DeliveryCity"), TextField::create("DeliveryPostCode"), CountryDropdownField::create("DeliveryCountry"))));
     // Add Sidebar is editable
     if ($this->canEdit()) {
         $tab_customer->insertBefore(CustomerSidebar::create(new GridField("ExistingCustomers", "", $existing_customer::get(), $config = GridFieldConfig_Base::create()->addComponents($map_extension = new GridFieldMapExistingAction())))->setTitle("Use Existing Customer"), "BillingDetailsHeader");
         if (is_array($this->config()->existing_customer_fields)) {
             $columns = $config->getComponentByType("GridFieldDataColumns");
             if ($columns) {
                 $columns->setDisplayFields($this->config()->existing_customer_fields);
             }
         }
         // Set the record ID
         $map_extension->setMapFields($this->config()->existing_customer_map);
     }
     $tab_main->addExtraClass("order-admin-items");
     $tab_customer->addExtraClass("order-admin-customer");
     $this->extend("updateCMSFields", $fields);
     $fields->fieldByName('Root')->addextraClass('orders-root');
     return $fields;
 }
 public function getCMSFields()
 {
     $f = parent::getCMSFields();
     $f->addFieldToTab('Root.Main', new TextField('WebSiteUrl', 'WebSite Url'));
     $f->addFieldToTab('Root.Main', new CheckboxField('DisplayOnSite', 'Should Display On Site'));
     $f->addFieldToTab('Root.Main', $messageField = new TextField('LocationMessage', 'Message to display for this location'));
     $messageField->setAttribute('style', 'max-width:100% !important');
     $f->addFieldToTab('Root.Main', new CheckboxField('DetailsPage', 'Send people to a details page first?'));
     $f->addFieldsToTab("Root.Location", array(HiddenField::create("Lat"), HiddenField::create("Lng"), TextField::create("Address1"), TextField::create("Address2"), TextField::create("ZipCode"), TextField::create("City"), TextField::create("State"), CountryDropdownField::create("Country"), GoogleMapField::create("Map", array("height" => "500px", "width" => "600px", "lng_field" => "Form_ItemEditForm_Lng", "lat_field" => "Form_ItemEditForm_Lat", "address_field" => array('address1' => "Address1", 'zip_code' => "ZipCode", 'city' => "City", 'state' => "State", 'country' => "Country"), 'start_lat' => $this->Lat, 'start_lng' => $this->Lng))));
     if ($this->ID > 0) {
         $config = GridFieldConfig_RecordEditor::create();
         $gridField = new GridField('Maps', 'Maps', $this->Maps(), $config);
         $config->addComponent($sort = new GridFieldSortableRows('Order'));
         $f->addFieldToTab('Root.Maps', $gridField);
     }
     return $f;
 }