class JGoogleEmbedMaps extends JGoogleEmbed

Google Maps embed class for the Joomla Platform.

Methods

__construct( Registry $options = null, JUri $uri = null, JHttp $http = null)

Constructor.

string
isSecure()

Method to retrieve the javascript header for the embed API

string
getHeader()

Get code to load Google Maps javascript

string
getBody()

Method to retrieve the div that the map is loaded into

null
echoHeader()

Method to output the javascript header for the embed API

null
echoBody()

Method to output the body for the API

mixed
getOption( string $key)

Get an option from the JGoogleEmbed instance.

setOption( string $key, mixed $value)

Set an option for the JGoogleEmbed instance.

string
getKey()

Method to get the API key

setKey( string $key)

Method to set the API key

string
getMapId()

Method to get the id of the map div

setMapId( string $id)

Method to set the map div id

string
getMapClass()

Method to get the class of the map div

setMapClass( string $class)

Method to set the map div class

string
getMapStyle()

Method to get the style of the map div

setMapStyle( string $style)

Method to set the map div style

string
getMapType()

Method to get the map type setting

setMapType( string $type)

Method to set the map type ()

string
getAdditionalMapOptions()

Method to get additional map options

setAdditionalMapOptions( array $options)

Method to add additional map options

string
getAdditionalJavascript()

Method to get additional map options

setAdditionalJavascript( array $script)

Method to add additional javascript

int
getZoom()

Method to get the zoom

setZoom( int $zoom)

Method to set the map zoom

mixed
getCenter()

Method to set the center of the map

setCenter( mixed $location, mixed $title = true, array $markeroptions = array(), array $markerevents = array())

Method to set the center of the map

addEventHandler( string $type, string $function)

Method to add an event handler to the map.

string
deleteEventHandler( string $type = null)

Method to remove an event handler from the map

array
listEventHandlers()

List the events added to the map

mixed
addMarker( mixed $location, mixed $title = null, array $options = array(), array $events = array())

Add a marker to the map

array
listMarkers()

List the markers added to the map

array
deleteMarker( int $index = null)

Delete a marker from the map

boolean
isAsync()

Checks if the javascript is set to be asynchronous

useAsync()

Load javascript asynchronously

JGoogleEmbedAMaps
useSync()

Load javascript synchronously

string
getAsyncCallback()

Method to get callback function for async javascript loading

setAsyncCallback( string $callback)

Method to set the callback function for async javascript loading

boolean
hasSensor()

Checks if a sensor is set to be required

useSensor()

Require access to sensor data

JGoogleEmbedAMaps
noSensor()

Don't require access to sensor data

string
getAutoload()

Checks how the script should be loaded

JGoogleEmbedAMaps
setAutoload( string $type = 'onload')

Automatically add the callback to the window

array
geocodeAddress( string $address)

Method to get the location information back from an address

Details

__construct( Registry $options = null, JUri $uri = null, JHttp $http = null)

Constructor.

Parameters

Registry $options Google options object
JUri $uri URL of the page being rendered
JHttp $http Http client for geocoding requests

string isSecure()

Method to retrieve the javascript header for the embed API

Return Value

string The header

string getHeader()

Get code to load Google Maps javascript

Return Value

string The header

string getBody()

Method to retrieve the div that the map is loaded into

Return Value

string The body

null echoHeader()

Method to output the javascript header for the embed API

Return Value

null

null echoBody()

Method to output the body for the API

Return Value

null

mixed getOption( string $key)

Get an option from the JGoogleEmbed instance.

Parameters

string $key The name of the option to get.

Return Value

mixed The option value.

JGoogleEmbed setOption( string $key, mixed $value)

Set an option for the JGoogleEmbed instance.

Parameters

string $key The name of the option to set.
mixed $value The option value to set.

Return Value

JGoogleEmbed This object for method chaining.

string getKey()

Method to get the API key

Return Value

string The Google Maps API key

JGoogleEmbedMaps setKey( string $key)

Method to set the API key

Parameters

string $key The Google Maps API key

Return Value

JGoogleEmbedMaps The object for method chaining

string getMapId()

Method to get the id of the map div

Return Value

string The ID

JGoogleEmbedMaps setMapId( string $id)

Method to set the map div id

Parameters

string $id The ID

Return Value

JGoogleEmbedMaps The object for method chaining

string getMapClass()

Method to get the class of the map div

Return Value

string The class

JGoogleEmbedMaps setMapClass( string $class)

Method to set the map div class

Parameters

string $class The class

Return Value

JGoogleEmbedMaps The object for method chaining

string getMapStyle()

Method to get the style of the map div

Return Value

string The style

JGoogleEmbedMaps setMapStyle( string $style)

Method to set the map div style

Parameters

string $style The style

Return Value

JGoogleEmbedMaps The object for method chaining

string getMapType()

Method to get the map type setting

Return Value

string The class

JGoogleEmbedMaps setMapType( string $type)

Method to set the map type ()

Parameters

string $type Valid types are ROADMAP, SATELLITE, HYBRID, and TERRAIN

Return Value

JGoogleEmbedMaps The object for method chaining

string getAdditionalMapOptions()

Method to get additional map options

Return Value

string The options

JGoogleEmbedMaps setAdditionalMapOptions( array $options)

Method to add additional map options

Parameters

array $options Additional map options

Return Value

JGoogleEmbedMaps The object for method chaining

string getAdditionalJavascript()

Method to get additional map options

Return Value

string The options

JGoogleEmbedMaps setAdditionalJavascript( array $script)

Method to add additional javascript

Parameters

array $script Additional javascript

Return Value

JGoogleEmbedMaps The object for method chaining

int getZoom()

Method to get the zoom

Return Value

int The zoom level

JGoogleEmbedMaps setZoom( int $zoom)

Method to set the map zoom

Parameters

int $zoom Zoom level (0 is whole world)

Return Value

JGoogleEmbedMaps The object for method chaining

mixed getCenter()

Method to set the center of the map

Return Value

mixed A latitude longitude array or an address string

JGoogleEmbedMaps setCenter( mixed $location, mixed $title = true, array $markeroptions = array(), array $markerevents = array())

Method to set the center of the map

Parameters

mixed $location A latitude/longitude array or an address string
mixed $title Title of marker or false for no marker
array $markeroptions Options for marker
array $markerevents Events for marker

Return Value

JGoogleEmbedMaps The latitude/longitude of the center or false on failure

JGoogleEmbedMaps addEventHandler( string $type, string $function)

Method to add an event handler to the map.

Event handlers must be passed in either as callback name or fully qualified function declaration

Parameters

string $type The event name
string $function The event handling function body

Return Value

JGoogleEmbedMaps The object for method chaining

string deleteEventHandler( string $type = null)

Method to remove an event handler from the map

Parameters

string $type The event name

Return Value

string The event handler content

array listEventHandlers()

List the events added to the map

Return Value

array A list of events

mixed addMarker( mixed $location, mixed $title = null, array $options = array(), array $events = array())

Add a marker to the map

Parameters

mixed $location A latitude/longitude array or an address string
mixed $title The hover-text for the marker
array $options Options for marker
array $events Events for marker

Return Value

mixed The marker or false on failure

array listMarkers()

List the markers added to the map

Return Value

array A list of markers

array deleteMarker( int $index = null)

Delete a marker from the map

Parameters

int $index Index of marker to delete (defaults to last added marker)

Return Value

array The latitude/longitude of the deleted marker

boolean isAsync()

Checks if the javascript is set to be asynchronous

Return Value

boolean True if asynchronous

JGoogleEmbedMaps useAsync()

Load javascript asynchronously

Return Value

JGoogleEmbedMaps The object for method chaining

JGoogleEmbedAMaps useSync()

Load javascript synchronously

Return Value

JGoogleEmbedAMaps The object for method chaining

string getAsyncCallback()

Method to get callback function for async javascript loading

Return Value

string The ID

JGoogleEmbedMaps setAsyncCallback( string $callback)

Method to set the callback function for async javascript loading

Parameters

string $callback The callback function name

Return Value

JGoogleEmbedMaps The object for method chaining

boolean hasSensor()

Checks if a sensor is set to be required

Return Value

boolean True if asynchronous

JGoogleEmbedMaps useSensor()

Require access to sensor data

Return Value

JGoogleEmbedMaps The object for method chaining

JGoogleEmbedAMaps noSensor()

Don't require access to sensor data

Return Value

JGoogleEmbedAMaps The object for method chaining

string getAutoload()

Checks how the script should be loaded

Return Value

string Autoload type (onload, jquery, mootools, or false)

JGoogleEmbedAMaps setAutoload( string $type = 'onload')

Automatically add the callback to the window

Parameters

string $type The method to add the callback (options are onload, jquery, mootools, and false)

Return Value

JGoogleEmbedAMaps The object for method chaining

array geocodeAddress( string $address)

Method to get the location information back from an address

Parameters

string $address The address to geocode

Return Value

array An array containing Google's geocode data