name = 'google_map'; $this->label = __("Google Map",'acf'); $this->category = __("jQuery",'acf'); $this->defaults = array( 'height' => '', 'center_lat' => '', 'center_lng' => '', 'zoom' => '' ); $this->default_values = array( 'height' => '400', 'center_lat' => '-37.81411', 'center_lng' => '144.96328', 'zoom' => '14' ); $this->l10n = array( 'locating' => __("Locating",'acf'), 'browser_support' => __("Sorry, this browser does not support geolocation",'acf'), ); // do not delete! parent::__construct(); } /* * create_field() * * Create the HTML interface for your field * * @param $field - an array holding all the field's data * * @type action * @since 3.6 * @date 23/01/13 */ function create_field( $field ) { // require the googlemaps JS ( this script is now lazy loaded via JS ) //wp_enqueue_script('acf-googlemaps'); // default value if( !is_array($field['value']) ) { $field['value'] = array(); } $field['value'] = wp_parse_args($field['value'], array( 'address' => '', 'lat' => '', 'lng' => '' )); // default options foreach( $this->default_values as $k => $v ) { if( ! $field[ $k ] ) { $field[ $k ] = $v; } } // vars $o = array( 'class' => '', ); if( $field['value']['address'] ) { $o['class'] = 'active'; } $atts = ''; $keys = array( 'data-id' => 'id', 'data-lat' => 'center_lat', 'data-lng' => 'center_lng', 'data-zoom' => 'zoom' ); foreach( $keys as $k => $v ) { $atts .= ' ' . $k . '="' . esc_attr( $field[ $v ] ) . '"'; } ?>
>
$v ): ?>
">Locate " class="search" />

'number', 'name' => 'fields['.$key.'][zoom]', 'value' => $field['zoom'], 'placeholder' => $this->default_values['zoom'] )); ?>

'number', 'name' => 'fields['.$key.'][height]', 'value' => $field['height'], 'append' => 'px', 'placeholder' => $this->default_values['height'] )); ?> 'places', 'key' => '', 'client' => '' ); // 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']); ?>