acf_field_google_map::render_field()
Create the HTML interface for your field
Метод класса: acf_field_google_map{}
Хуков нет.
Возвращает
null
. Ничего (null).
Использование
$acf_field_google_map = new acf_field_google_map(); $acf_field_google_map->render_field( $field );
- $field (обязательный)
- -
Список изменений
С версии 3.6 | Введена. |
Код acf_field_google_map::render_field() acf field google map::render field ACF 6.0.4
<?php function render_field( $field ) { // Apply defaults. foreach ( $this->default_values as $k => $v ) { if ( ! $field[ $k ] ) { $field[ $k ] = $v; } } // Attrs. $attrs = array( 'id' => $field['id'], 'class' => "acf-google-map {$field['class']}", 'data-lat' => $field['center_lat'], 'data-lng' => $field['center_lng'], 'data-zoom' => $field['zoom'], ); $search = ''; if ( $field['value'] ) { $attrs['class'] .= ' -value'; $search = $field['value']['address']; } else { $field['value'] = ''; } ?> <div <?php echo acf_esc_attrs( $attrs ); ?>> <?php acf_hidden_input( array( 'name' => $field['name'], 'value' => $field['value'], ) ); ?> <div class="title"> <div class="acf-actions -hover"> <a href="#" data-name="search" class="acf-icon -search grey" title="<?php _e( 'Search', 'acf' ); ?>"></a> <a href="#" data-name="clear" class="acf-icon -cancel grey" title="<?php _e( 'Clear location', 'acf' ); ?>"></a> <a href="#" data-name="locate" class="acf-icon -location grey" title="<?php _e( 'Find current location', 'acf' ); ?>"></a> </div> <input class="search" type="text" placeholder="<?php _e( 'Search for address...', 'acf' ); ?>" value="<?php echo esc_attr( $search ); ?>" /> <i class="acf-loading"></i> </div> <div class="canvas" style="<?php echo esc_attr( 'height: ' . $field['height'] . 'px' ); ?>"></div> </div> <?php }