acf_field_google_map::format_placeprivateACF 6.8.0

Format value as Place.

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

Хуков нет.

Возвращает

array|null.

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

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

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

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

Код acf_field_google_map::format_place() ACF 6.8.8

private function format_place( $value ) {
	$place = array(
		'@type' => 'Place',
	);

	// Add name if available.
	if ( ! empty( $value['name'] ) ) {
		$place['name'] = $value['name'];
	}

	// Add full address as formatted string.
	if ( ! empty( $value['address'] ) ) {
		$place['address'] = $value['address'];
	}

	// Add geo coordinates.
	$geo = $this->format_geo_coordinates( $value );
	if ( $geo ) {
		$place['geo'] = $geo;
	}

	// Only return if we have meaningful data beyond @type.
	if ( count( $place ) > 1 ) {
		return $place;
	}

	return null;
}