\GeoDataUploadField
GeoDataUploadField For recording the geolocation of images, movies etc.
Automatically displays a map under the upload field using the Google Maps API and includes hidden
fields on the form to record the latitude, longitute, and zoom level which are then saved to the
dataobject after the form is submitted.
If the file has geolocation tags in it (such as jpeg) the marker on the map will move automatically
to that location. The user can move the map marker / pin manually to specify the location of the media.
You can also search for locations using the search box (if enabled), which uses the Google Maps Geocoding API.
- Author: <@zarocknz> Note: Heavily based on the silverstripe-googlemapfield by @willmorgan, but altered as needed to do what I want.
Synopsis
class GeoDataUploadField
extends UploadField
{
- // members
- protected FormField $latField;
- protected $latFieldName;
- protected FormField $lngField;
- protected $lngFieldName;
- protected FormField $zoomField;
- protected $zoomFieldName;
- protected array $options = ;
- // methods
- public void __construct()
- public void setupOptions()
- public FieldList setupChildren()
- public string getDefaultValue()
- public UploadField setValue()
- protected void requireDependencies()
- public mixed getOption()
- public $this setOption()
- public void Field()
- public FieldList getChildFields()
- public [type] saveInto()
Hierarchy
Extends
- UploadField
Members
protected
Methods
protected
- requireDependencies() — Includes needed things in the front end.
public
- __construct() — Constructor
- Field() — Called by SS to output the field.
- getChildFields()
- getDefaultValue() — Returns the default value for the field.
- getOption() — Get the merged option that was set on __construct
- saveInto() — Called before the dataobject record is saved.
- setOption() — Set an option for this field
- setValue() — Sets the value of the field and also of the child fields.
- setupChildren() — Set up child hidden fields, and optionally the search box.
- setupOptions() — Merge options preserving the first level of array keys