acf_field_google_map::input_admin_enqueue_scriptspublicACF 5.3.2

description

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

Хуки из метода

Возвращает

$post_id. (int)

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

$acf_field_google_map = new acf_field_google_map();
$acf_field_google_map->input_admin_enqueue_scripts();

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

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

Код acf_field_google_map::input_admin_enqueue_scripts() ACF 6.4.2

function input_admin_enqueue_scripts() {

	// localize
	acf_localize_text(
		array(
			'Sorry, this browser does not support geolocation'  => __( 'Sorry, this browser does not support geolocation', 'acf' ),
		)
	);

	// bail early if no enqueue
	if ( ! acf_get_setting( 'enqueue_google_maps' ) ) {
		return;
	}

	// vars
	$api = array(
		'key'       => acf_get_setting( 'google_api_key' ),
		'client'    => acf_get_setting( 'google_api_client' ),
		'libraries' => 'places',
		'ver'       => 3,
		'callback'  => 'Function.prototype',
		'language'  => acf_get_locale(),
	);

	// filter
	$api = apply_filters( 'acf/fields/google_map/api', $api );

	// remove empty
	if ( empty( $api['key'] ) ) {
		unset( $api['key'] );
	}
	if ( empty( $api['client'] ) ) {
		unset( $api['client'] );
	}

	// construct url
	$url = add_query_arg( $api, 'https://maps.googleapis.com/maps/api/js' );

	// localize
	acf_localize_data(
		array(
			'google_map_api' => $url,
		)
	);
}