Skip to the content
Documentation

MapLocation Field Type: comparison of v.8 vs v.9

No ratings yet

Versions Compared

Old Version 8

changes.mady.by.user Dominika Kurek

Saved on Jan 04, 2017

compared with

New Version Current

changes.mady.by.user André Rømcke

Saved on Jan 17, 2017

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Comment: Add simple config example

This Field Type represents a geographical location.

Name Internal name Expected input
MapLocation ezgmaplocation mixed

Description

This Field Type makes possible to store and retrieve a geographical location.

As input it expects two float values, latitude, longitude, and a string value in third place, corresponding to the name or address of the location.

PHP API Field Type 

Input expectations

Type Example
array
array( 'latitude' => 59.928732, 'longitude' => 10.777888, 'address' => "eZ Systems Norge" )

Value object

Properties

The Value class of this Field Type contains the following properties:

Property Type Description
$latitude  float This property will store the latitude value of the map location reference.
$longitude
float This property will store the longitude value of the map location reference.
$address string This property will store the address of map location.
Constructor

The MapLocation\Value constructor will initialize a new Value object with the values provided. Two floats and a string are expected.

Code Block
language php
title Constructor example
// Instantiates a MapLocation Value object
$MapLocationValue = new MapLocation\Value( 59.928732, 10.777888, "eZ Systems Norge" );

Template rendering

The template called by the ez_render_field() Twig function while rendering a Map Location field accepts the following the parameters:

Parameter Type Default Description
mapType string "ROADMAP" One of the GMap type of map
showMap boolean true Whether to show a Google Map
showInfo booolean true Whether to show a latitude, longitude and the address outside of the map
zoom integer 13 The initial zoom level on the map
draggable boolean true Whether to enable draggable map
width string|false "500px" The width of the rendered map with its unit (for example "500px" or "50em"), set to false to not set any width style inline.
height string|false "200px" The height of the rendered map with its unit (for example "200px" or "20em"), set to false to not set any height style inline.
scrollWheel boolean true
Status
colour Yellow
title >=1.7.1
Allows you to disable scroll wheel starting to zoom when mouse comes over the map as user scrolls down a page.

Example:

Code Block
{{ ez_render_field(content, 'location', {'parameters': {'width': '100%', 'height': '330px', 'showMap': true, 'showInfo': false}}) }}

Configuration

Status
colour Yellow
title >=1.7.1

 

Config Site Access/Group aware Description
api_keys.google_maps yes Google maps requires use of a API key for severing maps to web pages, this setting allows you to specify your personal Google Maps API key used during template rendering.

Example use:

Code Block
title ezplatform.yml
exponential:
    system:
        site_group:
            api_keys: { google_maps: "MY_KEY" }

 

Comments

Add a comment

Comments are read by a moderator before they appear.