acf_field_google_map::format_geo_coordinates │ private │ ACF 6.8.0

Format value as GeoCoordinates.

Method of the class: acf_field_google_map{}

No Hooks.

Returns

array|null.

Usage

// private - for code of main (parent) class only
$result = $this->format_geo_coordinates( $value );
$value(array) (required)
The google map value array.

Changelog

Since 6.8.0 Introduced.

acf_field_google_map::format_geo_coordinates() code ACF 6.8.8

private function format_geo_coordinates( $value ) {
	if ( empty( $value['lat'] ) || empty( $value['lng'] ) ) {
		return null;
	}

	return array(
		'@type'     => 'GeoCoordinates',
		'latitude'  => (float) $value['lat'],
		'longitude' => (float) $value['lng'],
	);
}