You are here

function gm3_field_field_settings_form in Google Maps API V3 7

Implementation of hook_field_settings_form().

File

gm3_field/gm3_field.module, line 121

Code

function gm3_field_field_settings_form($field, $instance, $has_data) {
  $form = array(
    'allow_text_entry' => array(
      '#type' => 'radios',
      '#title' => t('Allow text entry'),
      '#options' => array(
        'No',
        'Yes',
      ),
      '#default_value' => isset($field['settings']['allow_text_entry']) ? $field['settings']['allow_text_entry'] : $field['type'] == 'gm3_point' && $field['cardinality'] == 1 ? 1 : 0,
      '#required' => TRUE,
      '#description' => t('Select whether a user can also enter data using a text field'),
    ),
  );
  switch ($field['type']) {
    case 'gm3_combination':
      $options = array(
        'gm3_point' => 'Point',
        'gm3_polygon' => 'Polygon',
        'gm3_polyline' => 'Polyline',
        'gm3_rectangle' => 'Rectangle',
      );
      drupal_alter('gm3_combination_field_options', $options);
      $form['field_types'] = array(
        '#type' => 'select',
        '#title' => t('Field types'),
        '#options' => $options,
        '#multiple' => TRUE,
        '#default_value' => isset($field['settings']['field_types']) ? $field['settings']['field_types'] : $options,
        // Default to all
        '#required' => TRUE,
        '#description' => t('Select the types of Widget you would like to use'),
      );
  }
  return $form;
}