function getlocations_leaflet_field_formatter_settings_form in Get Locations 7
Same name and namespace in other branches
- 7.2 modules/getlocations_leaflet/getlocations_leaflet.module \getlocations_leaflet_field_formatter_settings_form()
Implements hook_field_formatter_settings_form(). Returns form elements for a formatter's settings.
Parameters
$field: The field structure being configured.
$instance: The instance structure being configured.
$view_mode: The view mode being configured.
$form: The (entire) configuration form array, which will usually have no use here.
$form_state: The form state of the (entire) configuration form.
Return value
The form elements for the formatter settings.
File
- modules/
getlocations_leaflet/ getlocations_leaflet.module, line 981 - getlocations_leaflet.module @author Bob Hutchinson http://drupal.org/user/52366 @copyright GNU GPL
Code
function getlocations_leaflet_field_formatter_settings_form($field, $instance, $view_mode, $form, &$form_state) {
$getlocations_leaflet_paths = getlocations_leaflet_paths_get();
drupal_add_js($getlocations_leaflet_paths['getlocations_leaflet_formatter_path']);
$display = $instance['display'][$view_mode];
$settings = $display['settings'];
$element = array();
switch ($display['type']) {
case 'getlocations_leaflet_map':
$settings['map_resize'] = 0;
$settings['fullscreen_disable'] = 0;
$settings['styles'] = '';
$labels = array(
'width' => t('Width'),
'height' => t('Height'),
);
$element += getlocations_map_display_basics_form($settings, $labels);
unset($element['map_resize']);
unset($element['fullscreen_disable']);
unset($element['styles']);
$element['width']['#element_validate'] = array(
'getlocations_element_validate_dim',
);
$element['height']['#element_validate'] = array(
'getlocations_element_validate_dim',
);
$element['latlong']['#element_validate'] = array(
'getlocations_element_validate_latlon',
);
unset($element['zoom']['#options']['21']);
unset($element['zoom']['#options']['20']);
unset($element['zoom']['#options']['19']);
unset($element['minzoom_map']['#options']['21']);
unset($element['minzoom_map']['#options']['20']);
unset($element['minzoom_map']['#options']['19']);
unset($element['maxzoom_map']['#options']['21']);
unset($element['maxzoom_map']['#options']['20']);
unset($element['maxzoom_map']['#options']['19']);
$element += getlocations_leaflet_display_options_form($settings, TRUE);
unset($element['nodezoom']['#options']['21']);
unset($element['nodezoom']['#options']['20']);
unset($element['nodezoom']['#options']['19']);
// awesome?
break;
case 'getlocations_leaflet_link':
$element['text'] = array(
'#type' => 'textfield',
'#title' => t('Default text'),
'#description' => t('The text to use if no other option is available.'),
'#default_value' => $settings['text'],
'#size' => 25,
);
$element['text_opt'] = array(
'#type' => 'select',
'#title' => t('Display format'),
'#default_value' => $settings['text_opt'],
'#options' => $settings['text_options'],
);
break;
}
return $element;
}