function getlocations_fields_field_formatter_settings_form in Get Locations 7.2
Same name and namespace in other branches
- 7 modules/getlocations_fields/getlocations_fields.module \getlocations_fields_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_fields/ getlocations_fields.module, line 700 - getlocations_fields.module @author Bob Hutchinson http://drupal.org/user/52366 @copyright GNU GPL
Code
function getlocations_fields_field_formatter_settings_form($field, $instance, $view_mode, $form, &$form_state) {
$getlocations_fields_paths = getlocations_fields_paths_get();
drupal_add_js($getlocations_fields_paths['getlocations_fields_formatter_path']);
$display = $instance['display'][$view_mode];
$settings = $display['settings'];
$getlocations_fields_defaults = getlocations_fields_defaults();
if (empty($settings)) {
$settings = $getlocations_fields_defaults;
}
// $instance['entity_type'] contains node, user etc
$entity_type = $instance['entity_type'];
$bundle = $instance['bundle'];
$field_name = $instance['field_name'];
$element = array();
// address display options
$element += getlocations_fields_display_settings_form($settings);
$element['display_mapwidth']['#element_validate'] = array(
'getlocations_element_validate_dim',
);
$element['display_mapheight']['#element_validate'] = array(
'getlocations_element_validate_dim',
);
// map display options
$element += getlocations_map_display_options_form($settings, FALSE);
// markers
$getlocations_markers = variable_get('getlocations_markers', array());
if (isset($getlocations_markers[$entity_type]['enable']) && $getlocations_markers[$entity_type]['enable']) {
$type_markers = getlocations_get_type_markers();
foreach ($type_markers as $et => $bundles) {
if ($et == $entity_type) {
$entity_get_info = entity_get_info($entity_type);
$entity_type_label = $entity_get_info['label'];
foreach ($bundles as $bd => $field_names) {
foreach ($field_names as $fn => $marker_data) {
if ($bd == $bundle && $fn == $field_name) {
$markers = getlocations_get_marker_titles();
$bundle_label = $marker_data['bundle_label'];
#$element['marker'][$entity_type][$bundle][$field_name]['marker'] = getlocations_element_map_marker(
$element['marker_ma'] = getlocations_element_map_marker(t('Type %etl, Bundle %name, Field %field Map marker', array(
'%etl' => $entity_type_label,
'%name' => $bundle_label,
'%field' => $field_name,
)), $markers, isset($getlocations_markers[$entity_type][$bundle][$field_name]['marker']) ? $getlocations_markers[$entity_type][$bundle][$field_name]['marker'] : (isset($getlocations_defaults[$entity_type . '_map_marker']) ? $getlocations_defaults[$entity_type . '_map_marker'] : $getlocations_defaults['map_marker']));
$element['marker_et'] = array(
'#type' => 'value',
'#value' => $entity_type,
);
$element['marker_bd'] = array(
'#type' => 'value',
'#value' => $bundle,
);
$element['marker_fn'] = array(
'#type' => 'value',
'#value' => $field_name,
);
}
}
}
}
}
}
// markeraction
$element += getlocations_markeraction_form($settings);
if (module_exists('getdirections')) {
$element['getdirections_link'] = getlocations_element_map_checkbox(t('Link to Getdirections in bubble'), $settings['getdirections_link'], t('Include a link to the Getdirections page in InfoBubble/InfoWindow.'));
}
// views_search_marker etc
if (module_exists('views')) {
$element += getlocations_fields_views_search_form($settings);
}
// streetview overlay settings
$element += getlocations_fields_sv_control_form($settings);
unset($element['#theme']);
$element['#theme'] = 'getlocations_fields_field_formatter_settings_form';
$element['#element_validate'] = array(
'getlocations_fields_field_formatter_settings_validate',
);
return $element;
}