You are here

function getlocations_leaflet_field_settings_form in Get Locations 7

Same name and namespace in other branches
  1. 7.2 modules/getlocations_leaflet/getlocations_leaflet.module \getlocations_leaflet_field_settings_form()

Implements hook_field_settings_form(). Add settings to a field settings form.

Invoked from field_ui_field_settings_form() to allow the module defining the field to add global settings (i.e. settings that do not depend on the bundle or instance) to the field settings form. If the field already has data, only include settings that are safe to change.

@todo: Only the field type module knows which settings will affect the field's schema, but only the field storage module knows what schema changes are permitted once a field already has data. Probably we need an easy way for a field type module to ask whether an update to a new schema will be allowed without having to build up a fake $prior_field structure for hook_field_update_forbid().

Parameters

$field: The field structure being configured.

$instance: The instance structure being configured.

$has_data: TRUE if the field already has data, FALSE if not.

Return value

The form definition for the field settings.

File

modules/getlocations_leaflet/getlocations_leaflet.module, line 2089
getlocations_leaflet.module @author Bob Hutchinson http://drupal.org/user/52366 @copyright GNU GPL

Code

function getlocations_leaflet_field_settings_form($field, $instance, $has_data) {
  $settings = $field['settings'];
  if (empty($settings)) {
    $settings = getlocations_leaflet_field_info();
  }
  $form = array();

  // input_text
  if (module_exists('views_bulk_operations')) {
    $form['input_text'] = array(
      '#type' => 'checkbox',
      '#title' => t('Use a textfield'),
      '#description' => t('Select this setting if you intend to use VBO to update data.'),
      '#default_value' => isset($settings['input_text']) ? $settings['input_text'] : 0,
      '#return_value' => 1,
    );
  }
  else {
    $form['input_text'] = array(
      '#type' => 'value',
      '#value' => 0,
    );
  }
  return $form;
}