acf_field_google_map::format_geo_coordinatesprivateACF 6.8.0

Format value as GeoCoordinates.

Метод класса: acf_field_google_map{}

Хуков нет.

Возвращает

array|null.

Использование

// private - только в коде основоного (родительского) класса
$result = $this->format_geo_coordinates( $value );
$value(массив) (обязательный)
The google map value array.

Список изменений

С версии 6.8.0 Введена.

Код acf_field_google_map::format_geo_coordinates() 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'],
	);
}