acf_field_google_map::input_admin_enqueue_scripts()publicACF 1.0

input_admin_enqueue_scripts
*

  • description
  • @type function
  • @date 16/12/2015
  • @since 5.3.2

  • @param $post_id (int)
  • @return $post_id (int)

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

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

Возвращает

null. Ничего.

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

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

Код acf_field_google_map::input_admin_enqueue_scripts() ACF 5.10.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 ealry 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'  => '',
		'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,
		)
	);
}