acf_field_google_map::input_admin_enqueue_scripts
input_admin_enqueue_scripts
*
- description
- @type function
- @date 16/12/2015
-
@since 5.3.2
- @param $post_id (int)
- @return $post_id (int)
Method of the class: acf_field_google_map{}
Hooks from the method
Returns
null. Nothing (null).
Usage
$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 field google map::input admin enqueue scripts code ACF 6.0.4
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' => '',
'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,
)
);
}