You are here

function uuidreference_field_settings_form in UUID reference field 7

Implements hook_field_settings_form().

File

./uuidreference.module, line 106

Code

function uuidreference_field_settings_form($field, $instance, $has_data) {

  // Select the target entity type.
  $entity_type_options = array();
  foreach (entity_get_info() as $entity_type => $info) {
    $entity_type_options[$entity_type] = $info['label'];
  }
  $form['target_type'] = array(
    '#type' => 'select',
    '#title' => t('Target type'),
    '#options' => $entity_type_options,
    '#default_value' => $field['settings']['target_type'],
    '#required' => TRUE,
    '#description' => t('The entity type that can be referenced via this field.'),
    '#disabled' => $has_data,
    '#size' => 1,
    '#ajax' => array(
      'callback' => 'uuidreference_field_settings_ajax_callback',
      'wrapper' => 'uuidreference-field-settings-bundles',
    ),
    '#limit_validation_errors' => array(),
  );

  // The bundle options will be added in hook_form_alter.
  // @see uuidreference_form_alter().
  return $form;
}