function google_map_field_format_field in Google Map Field 7.2
Same name and namespace in other branches
- 7 google_map_field.module \google_map_field_format_field()
This function formats the google map field for display, called by google_map_field_field_formatter_view().
1 call to google_map_field_format_field()
File
- ./
google_map_field.module, line 181 - This file defines all the necessary hooks and functions to create a Google Map Field field type for inserting maps directly into content items (node, entities etc).
Code
function google_map_field_format_field($item, $delta, $display) {
require module_load_include('inc', 'google_map_field');
$js_settings = array();
foreach ($settings as $type_name => $data) {
$js_settings[$type_name] = variable_get('google_map_field_' . $type_name, $data['default']);
}
drupal_add_js(array(
'googleMapField' => $js_settings,
), 'setting');
drupal_add_js(drupal_get_path('module', 'google_map_field') . '/js/google_map_field_node_display.js', 'file');
google_map_field_add_maps_api();
$element = array(
'#type' => 'container',
'#attributes' => array(
'class' => array(
'field-item',
),
),
);
$element['google_map_field'] = array(
'item' => array(
'#type' => 'container',
'#attributes' => array(
'class' => array(
'field-item',
),
),
'text' => array(
'#markup' => theme('google_map_field', array(
'name' => check_plain($item['name']),
'lat' => $item['lat'],
'lng' => $item['lon'],
'zoom' => $item['zoom'],
)),
),
),
);
return $element;
}