function google_map_field_after_build in Google Map Field 7
Function to add necessary JS and CSS after form has built.
1 string reference to 'google_map_field_after_build'
- google_map_field_field_widget_form in ./
google_map_field.module - Implements hook_field_widget_form().
File
- ./
google_map_field.module, line 349 - This file defines all the necessary hooks and functions to create a Google Map Field field type and also a WYSIWYG editor plugin for inserting maps directly into filtered content.
Code
function google_map_field_after_build($form, &$form_state) {
//google_map_field_add_maps_api();
drupal_add_js(drupal_get_path('module', 'google_map_field') . '/js/google_map_field_edit_form.js', 'file');
drupal_add_js(drupal_get_path('module', 'google_map_field') . '/js/google_map_field_widget_form.js', 'file');
drupal_add_css(drupal_get_path('module', 'google_map_field') . '/wysiwyg_plugins/gmf_tokenbuilder/css/gmf_tokenbuilder.css');
drupal_add_css(drupal_get_path('module', 'google_map_field') . '/css/google_map_field.css');
drupal_add_library('system', 'ui.dialog');
drupal_add_library('system', 'ui.draggable');
// Build the inline JS to build the map.
$settings = array(
'gmf_widget_form' => array(
'lat' => is_numeric($form['lat']['#value']) ? $form['lat']['#value'] : 51.51906840672028,
'lon' => is_numeric($form['lon']['#value']) ? $form['lon']['#value'] : -0.11661621093753638,
'zoom' => is_numeric($form['zoom']['#value']) ? $form['zoom']['#value'] : 9,
'fname' => $form['#fname'],
),
);
drupal_add_js($settings, 'setting');
return $form;
}