Presenter Output
This section will show you how to use the decorated value provided by the \Anomaly\GeocoderFieldType\GeocoderFieldTypePresenter
class.
GeocoderFieldTypePresenter::image()
The image
method returns a generated image of the map area.
Returns: string
Arguments
Key | Required | Type | Default | Description |
---|---|---|---|---|
$options |
false |
array |
none |
The image options. |
$formatted |
true |
boolean |
false |
Use the formatted address location instead of the potentially adjusted marker location. |
Example
$decorated->example->image();
Twig
{{ decorated.example.image()|raw }}
Available Option
Below are a list of available options
for the image method's options
argument.
Properties
Key | Required | Type | Default | Description |
---|---|---|---|---|
scale |
false |
integer |
1 |
The scale of the map. |
zoom |
false |
integer |
The configured zoom. |
The zoom of the map. |
format |
false |
string |
png |
The output format of the image. Valid options are |
maptype |
false |
string |
roadmap |
The Google maptype. Valid options are |
width |
false |
integer |
150 |
The width of the resulting image. |
height |
false |
integer |
100 |
The height of the resulting image. |
GeocoderFieldTypePresenter::embed()
The embed
method returns an embedded Google map.
Returns: string
Arguments
Key | Required | Type | Default | Description |
---|---|---|---|---|
$options |
false |
array |
none |
The image options. |
$formatted |
true |
boolean |
false |
Use the formatted address location instead of the potentially adjusted marker location. |
Example
$decorated->example->embed()->height(500);
Twig
{{ decorated.example.embed().height(500)|raw }}
Available Options
Below are a list of available options
for the embed method's options
argument.
Options
Key | Required | Type | Default | Description |
---|---|---|---|---|
scale |
false |
integer |
1 |
The scale of the map. |
scrollwheel |
false |
boolean |
true |
Set to |
zoom |
false |
integer |
15 |
The output map zoom. |
height |
false |
integer |
none |
The style height in pixels if any of the map div. |
GeocoderFieldTypePresenter::url()
The url
method returns the Google Maps URL for the address.
Returns: string
Arguments
Key | Required | Type | Default | Description |
---|---|---|---|---|
$formatted |
false |
boolean |
false |
Use the formatted address location instead of the potentially adjusted marker location. |
Example
$decorated->example->url();
Twig
{{ decorated.example.url() }}
GeocoderFieldTypePresenter::link()
The link
method returns an HTML link to the Google Maps URL.
Returns: string
Arguments
Key | Required | Type | Default | Description |
---|---|---|---|---|
$title |
true |
string |
none |
The link title. |
$attributes |
false |
array |
none |
The array of HTML attributes of the link. |
$secure |
false |
boolean |
True if request is secure. |
Force a secure URL. |
$formatted |
false |
boolean |
false |
Use the formatted address location instead of the potentially adjusted marker location. |
GeocoderFieldTypePresenter::position()
The position
method returns an array containing the longitude
and latitude
values.
Returns: array
Arguments
Key | Required | Type | Default | Description |
---|---|---|---|---|
$formatted |
false |
boolean |
false |
Use the formatted address location instead of the potentially adjusted marker location. |
Example
$decorated->example->position()['longitude'];
Twig
{{ decorated.example.position().longitude }}
GeocoderFieldTypePresenter::latitude()
The latitude
method is a shortcut to return the value's latitude position.
Returns: float
Arguments
Key | Required | Type | Default | Description |
---|---|---|---|---|
$formatted |
false |
boolean |
false |
Use the formatted address location instead of the potentially adjusted marker location. |
Example
$deocrated->example->latitude();
Twig
{{ decorated.example.latitude() }}
GeocoderFieldTypePresenter::longitude()
The longitude
method is a shortcut to return the value's longitude position.
Returns: float
Arguments
Key | Required | Type | Default | Description |
---|---|---|---|---|
$formatted |
false |
boolean |
false |
Use the formatted address location instead of the potentially adjusted marker location. |
Example
$decorated->example->longitude();
Twig
{{ decorated.example.longitude() }}
GeocoderFieldTypePresenter::point()
The point
method returns a Point
instance for use within spatial utilities.
Returns: \Anomaly\GeocoderFieldType\Spatial\Point
Arguments
Key | Required | Type | Default | Description |
---|---|---|---|---|
$formatted |
false |
bool |
none |
Whether to use the formatted latitude and longitude instead of the adjustable marker. |
Example
$decorated->point();
Twig
{{ decorated.point() }}
GeocoderFieldTypePresenter::geocode()
The geocode
method returns a geocoder point (as opposed to the above spatial point).
Returns: \Anomaly\GeocoderFieldType\GeocoderFieldTypePoint
Arguments
Key | Required | Type | Default | Description |
---|---|---|---|---|
$formatted |
false |
bool |
none |
Whether to use the formatted address instead of the input address. |
Example
echo $decorated->geocode->city() . ', ' . $decorated->geocode->state();
Twig
{{ entry.location.geocode.city() }}, {{ entry.location.geocode.state() }}