1. Home
  2. Docs
  3. WordPress Studio Framework
  4. Framework Fields
  5. Map Field

Map Field

Arguments

NameTypeDefaultDescription
idstring A unique ID. This ID will be used to get the value
typestringmapType of the field
titlestring Title of the field
defaultarray Default value from database, if the option doesn’t exist
subtitlestring Subtitle to display below the title.
descstring Description to display after the field
helpstring Text to display on right-corner (as hover/popup) of the field
classstring Extra CSS classes (space separated) to append to the field
beforestring Content to display before the field
afterstring Content to display after the field
dependencyarray Define field visibility depending on other field value
attributesarray Extra HTML attributes to append to the field
sanitizestring Callback function for sanitizing value
validatestring Callback function for validating value
EXTRAS   
placeholderstringSearch your address..The placeholder to be displayed when nothing is selected
latitude_textstringLatitudeThe text to display the latitude field top
longitude_textstringLongitudeThe text to display the longitude field top
heightstring250pxValue to set the default map height.

Default Arguments

NameTypeDescription
addressstringString representing the default address of map.
latitudenumberNumber representing latitude in degrees.
longitudenumberNumber representing longitude in degrees
zoomnumberNumber representing map zoom level.

Setting Arguments

NameTypeDefaultDescription
scrollWheelZoomboolfalseWhether the map can be zoomed by using the mouse wheel.

For more information on customizing the Map field

 

Simple Map Field Example

array(
  'id' => 'example-map',
  'type' => 'map',
  'title' => 'Map',
),

Map Field Example with Defaults

array(
  'id' => 'example-map',
  'type' => 'map',
  'title' => 'Map with Defaults',
  'default' => array(
    'address' => 'New York, United States of America',
    'latitude' => '40.7127281',
    'longitude' => '-74.0060152',
    'zoom' => '12',
  )
),

Map Field with Assigned Address Field

array(
  'id' => 'example-address',
  'type' => 'text',
  'title' => 'Address',
),
array(
  'id' => 'example-map',
  'type' => 'map',
  'title' => 'Map',
  'desc' => 'Use custom <strong>address_field</strong> field',
  'address_field' => 'example-address',
),

Map Field with Advanced Options

array(
  'id' => 'example-map',
  'type' => 'map',
  'title' => 'Map',
  'height' => '500px',
  'settings' => array(
    'scrollWheelZoom' => true,
  ),
),

 

array(
  'id' => 'example-map',
  'type' => 'map',
  'title' => 'Map',
  'height' => '500px',
  'settings' => array(
    'scrollWheelZoom' => true,
  ),
),

 

Was this article helpful to you? Yes No

How can we help?