function AddressLocationForm()
 {
     $shippingaddress = $this->getShippingAddress();
     $config = array('fieldNames' => array('lat' => 'Latitude', 'lng' => 'Longitude'), 'coords' => array(Address::config()->mapdefaults['latitude'], Address::config()->mapdefaults['longitude']), 'map' => array('zoom' => Address::config()->mapdefaults['zoom']), 'showSearchBox' => false);
     $fields = new FieldList(LiteralField::create("locationneededmessage", "<p class=\"message warning\">We could not automatically determine your shipping location. Please find and click the exact location on the map:</p>"), GoogleMapField::create($shippingaddress, "Location", $config)->setDescription("Please click the exact location of your address"));
     $actions = new FieldList(new FormAction("setAddressLocation", "Continue"));
     $form = new Form($this->owner, "AddressLocationForm", $fields, $actions);
     return $form;
 }
 public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     $fields->removeByname('ParentID');
     $fields->removeByname('Latitude');
     $fields->removeByname('Longitude');
     $fields->removeByname('Zoom');
     $fields->removeByname('Sort');
     $fields->addFieldsToTab("Root.Map", array(HeaderField::create("MapHeader", _t("GoogleMaps.MapHeader", "Generate your map")), GoogleMapField::create($this, "Find the location"), ReadOnlyField::create("Latitude"), ReadOnlyField::create("Longitude"), ReadOnlyField::create("Zoom")));
     return $fields;
 }
 public function updateCMSFields(FieldList $fields)
 {
     $fields->addFieldToTab("Root.Main", GoogleMapField::create($this->owner, "Location", array('fieldNames' => array('lat' => 'Latitude', 'lng' => 'Longitude'), 'showSearchBox' => false)));
     $fields->removeByName("Latitude");
     $fields->removeByName("Longitude");
 }
 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;
 }