PHP Class Carbon_Fields\Field\Map_Field

Allows to manually select a pin, or to position a pin based on a specified address. Coords (lat, lng), address and zoom are saved in the database.
Inheritance: extends Field
Show file Open project: htmlburger/carbon-fields

Protected Properties

Property Type Description
$address string Current address.
$default_lat float Default latitude.
$default_lng float Default longitude.
$default_zoom integer Default zoom.
$lat float | string Current latitude.
$lazyload boolean Whether to lazy load this field.
$lng float | string Current longitude.
$zoom integer Current zoom.

Public Methods

Method Description
admin_enqueue_scripts ( ) Enqueue scripts in the administration
load ( ) Load data from the datastore.
save ( ) Save data to the datastore.
set_position ( string $lat, string $lng, integer $zoom ) Set the coords and zoom of this field.
set_value_from_input ( array $input = null ) Load the field value from an input array based on it's name
template ( ) Underscore template of this field.
to_json ( boolean $load ) : array Returns an array that holds the field data, suitable for JSON representation.

Method Details

admin_enqueue_scripts() public static method

Enqueue scripts in the administration
public static admin_enqueue_scripts ( )

load() public method

Manually set the map field data fragments.
public load ( )

save() public method

Manually save the map field data fragments.
public save ( )

set_position() public method

Set the coords and zoom of this field.
public set_position ( string $lat, string $lng, integer $zoom )
$lat string Latitude
$lng string Longitude
$zoom integer Zoom level

set_value_from_input() public method

Load the field value from an input array based on it's name
public set_value_from_input ( array $input = null )
$input array (optional) Array of field names and values. Defaults to $_POST

template() public method

Underscore template of this field.
public template ( )

to_json() public method

This data will be available in the Underscore template and the Backbone Model.
public to_json ( boolean $load ) : array
$load boolean Should the value be loaded from the database or use the value from the current instance.
return array

Property Details

$address protected property

Current address.
protected string $address
return string

$default_lat protected property

Default latitude.
protected float $default_lat
return float

$default_lng protected property

Default longitude.
protected float $default_lng
return float

$default_zoom protected property

Default zoom.
protected int $default_zoom
return integer

$lat protected property

Current latitude.
protected float|string $lat
return float | string

$lazyload protected property

Whether to lazy load this field.
protected bool $lazyload
return boolean

$lng protected property

Current longitude.
protected float|string $lng
return float | string

$zoom protected property

Current zoom.
protected int $zoom
return integer