function location_cck_field_settings_form in Location 7.4
Same name and namespace in other branches
- 7.5 contrib/location_cck/location_cck.module \location_cck_field_settings_form()
- 7.3 contrib/location_cck/location_cck.module \location_cck_field_settings_form()
Implement hook_field_settings_form().
File
- contrib/
location_cck/ location_cck.module, line 50 - Defines location field type.
Code
function location_cck_field_settings_form($field, $instance, $has_data) {
$settings = $field['settings'];
$form = array();
$form['location_settings'] = location_settings($settings);
// Multiple is handled by CCK.
unset($form['location_settings']['multiple']);
// CCK handles weight, and collapsibility is not changeable.
unset($form['location_settings']['form']['weight']);
unset($form['location_settings']['form']['collapsible']);
unset($form['location_settings']['form']['collapsed']);
unset($form['location_settings']['display']['weight']);
// We want to see the settings, so uncollapse them.
$form['location_settings']['#collapsible'] = FALSE;
$form['location_settings']['form']['#collapsed'] = FALSE;
$form['location_settings']['display']['#collapsed'] = FALSE;
// Add some GMap settings, if GMap is enabled.
if (module_exists('gmap')) {
$form['gmap_macro'] = array(
'#type' => 'textarea',
'#title' => t('GMap Macro'),
'#rows' => 2,
'#maxlength' => 500,
'#description' => t('A macro to be used as a base map for this field. This map will be recentered on the location, so the center is not that important.'),
'#default_value' => !empty($field['gmap_macro']) ? $field['gmap_macro'] : '[gmap ]',
);
$options = gmap_get_marker_titles();
$form['gmap_marker'] = array(
'#type' => 'select',
'#title' => t('GMap marker'),
'#options' => $options,
'#default_value' => !empty($field['gmap_marker']) ? $field['gmap_marker'] : 'drupal',
);
}
else {
// Preserve existing data, apply defaults even if gmap is disabled.
$form['gmap_macro'] = array(
'#type' => 'value',
'#value' => !empty($field['gmap_macro']) ? $field['gmap_macro'] : '[gmap ]',
);
$form['gmap_marker'] = array(
'#type' => 'value',
'#value' => !empty($field['gmap_marker']) ? $field['gmap_marker'] : 'drupal',
);
}
return $form;
}