function leaflet_widget_field_widget_settings_form in Leaflet Widget for Geofield 7
Same name and namespace in other branches
- 7.2 leaflet_widget.module \leaflet_widget_field_widget_settings_form()
Implements hook_field_widget_settings_form().
File
- ./
leaflet_widget.module, line 39
Code
function leaflet_widget_field_widget_settings_form($field, $instance) {
$form = array();
$settings = $instance['widget']['settings'];
switch ($instance['widget']['type']) {
case 'leaflet_widget_widget':
$form['map'] = array(
'#type' => 'fieldset',
'#title' => 'Default map settings',
);
$form['map']['base_url'] = array(
'#type' => 'select',
'#title' => 'Leaflet.draw widget settings',
'#default_value' => $settings['map']['base_url'],
'#options' => leaflet_widget_base_layers(),
);
$form['map']['center'] = array(
'#type' => 'fieldset',
'#collapsed' => TRUE,
'#collapsible' => TRUE,
'#title' => 'Default map center',
);
$form['map']['center']['lat'] = array(
'#type' => 'textfield',
// 'hidden',
'#title' => 'Latitude',
'#default_value' => $settings['map']['center']['lat'],
'#required' => TRUE,
);
$form['map']['center']['lng'] = array(
'#type' => 'textfield',
// 'hidden',
'#title' => 'Longtitude',
'#default_value' => $settings['map']['center']['lng'],
'#required' => TRUE,
);
$form['map']['auto_center'] = array(
'#type' => 'checkbox',
'#title' => 'Automatically center map on existing features',
'#description' => "This option overrides the widget's default center.",
'#default_value' => $settings['map']['auto_center'],
);
$form['map']['zoom'] = array(
'#type' => 'textfield',
// 'hidden',
'#title' => 'Default zoom level',
'#default_value' => $settings['map']['zoom'],
'#required' => TRUE,
);
break;
}
return $form;
}