\GoogleMap
Synopsis
class GoogleMap
extends DataObject
{
- // members
- public static boolean $api_key = false;
- public static array $db = ;
- public static array $defaults = ;
- public static integer $default_width = 300;
- public static integer $default_height = 300;
- public static boolean $include_frontend_script = true;
- public static boolean $include_api_script = true;
- public static string $static_map_root = 'http://maps.googleapis.com/maps/api/staticmap';
- // methods
- public string getStaticMapLink()
- public string|boolean Link()
- public json toJSON()
- public string forTemplate()
- public void IncludeScripts()
- public static void include_scripts()
- public static void frontend_script_src()
- public static void api_script_src()
Hierarchy
Extends
- DataObject
Members
public
-
$api_key
Store the (optional) maps API key - $db
- $default_height
—
integer
Default height used for static maps - $default_width
—
integer
Default width used for static maps - $defaults
- $include_api_script
—
boolean
Whether to include the API script - $include_frontend_script
—
boolean
Whether to include the frontend script - $static_map_root
Methods
public
- IncludeScripts() — Used in the template to include the needed scripts
- Link() — Returns a link to this location on Google Maps based off the stored address. Returns false if there is no address
- api_script_src() — Returns the URL to the maps API script (eg for including via combine_files)
- forTemplate() — Render using the default template.
- frontend_script_src() — Returns the URL to the script that creates the map from JSON in a data attribute (eg for including via combine_files)
- getStaticMapLink() — Generates the URL for a static version of the map
- include_scripts() — For including the scripts from PHP (eg in controller's init) What scripts it actually includes is determined by the config, which can be set in your project's config.yml
- toJSON() — Returns all the properties needed for constructing a map as a JSON object, eg for putting in data-map-settings