You are here

function formatter_field_field_instance_settings_form in Formatter Field 7

Implements hook_field_instance_settings_form().

File

./formatter_field.module, line 35

Code

function formatter_field_field_instance_settings_form($field, $instance) {
  $settings = $instance['settings'];
  $instances = field_read_instances(array(
    'entity_type' => $instance['entity_type'],
    'bundle' => $instance['bundle'],
  ));
  foreach ($instances as $other_instance) {
    if ($other_instance['field_name'] != $instance['field_name']) {
      $options[$other_instance['field_name']] = $other_instance['label'];
    }
  }
  $form['field_name'] = array(
    '#type' => 'select',
    '#title' => t('Field to be formatted'),
    '#default_value' => $settings['field_name'],
    '#required' => TRUE,
    '#options' => $options,
    '#description' => t('The field to be formatted using the settings in this field.'),
  );
  return $form;
}