function gmap_widget_setup in GMap Module 5
Same name and namespace in other branches
- 6.2 gmap.module \gmap_widget_setup()
- 6 gmap.module \gmap_widget_setup()
- 7.2 gmap.module \gmap_widget_setup()
- 7 gmap.module \gmap_widget_setup()
Set up widget. This function will change a form element's ID so it is found by the GMap handlers system.
Parameters
&$element: The form element to modify.
$type: The gmap widget type to map to.
$map: The map id. If not defined, $element['#map'] will be used.
Return value
None.
8 calls to gmap_widget_setup()
- gmap_macro_builder_form in ./
gmap_macro_builder.module - Macro builder form.
- gmap_set_location in ./
gmap.module - Location chooser utility function.
- process_gmap_address in ./
gmap.module - Address widget #process function.
- process_gmap_align in ./
gmap.module - Alignment selector #process function.
- process_gmap_control in ./
gmap.module - Generic gmap control #process function.
File
- ./
gmap.module, line 939 - GMap -- Routines to use the Google Maps API in Drupal.
Code
function gmap_widget_setup(&$element, $type, $map = NULL) {
if (!$map) {
if (isset($element['#map'])) {
$map = $element['#map'];
}
else {
// Hmm, missing #map. Try to figure it out.
if (isset($element['#settings']['id'])) {
$map = $element['#settings']['id'];
}
}
}
if (!isset($element['#attributes']['class'])) {
$element['#attributes']['class'] = '';
}
$element['#attributes']['class'] = trim(implode(' ', array(
$element['#attributes']['class'],
'gmap-control',
'gmap-' . $type,
)));
$element['#id'] = gmap_get_id($map, $type);
$element['#map'] = $map;
}