Where can I see the options accepted by the field API for the widget type? Where can I see the options accepted by the field API for the widget type?

$instance = array(
  'field_name' =&gt; $field_name,
  'label' =&gt; 'Demofield Demo',
  'description' =&gt; 'This is a demonstration text field.'
  'widget' =&gt; array(
      'type' =&gt; 'text_textfield',
  )
);
There isn't a preset list of widget types; the widget types are the ones defined from modules that implement fields. Using the following code, you can get the list of all the widget types implemented by the enabled modules:

$array = module_invoke_all('field_info');

foreach ($array as $id =&gt; $info) {
  print $info['default_widget'];
}


The code essentially invokes all the implementations of hook_field_info(), and print what is defined as default widget.
If you have installed Devel, instead of print you can use dsm().

If you want to know the settings available for the field implementation, then you need to look for the implementation of hook_field_settings_form(), such as list_field_settings_form(), or text_field_settings_form().

function text_field_settings_form($field, $instance, $has_data) {
  $settings = $field['settings'];

  $form = array();

  if ($field['type'] == 'text') {
    $form['max_length'] = array(
      '#type' =&gt; 'textfield', 
      '#title' =&gt; t('Maximum length'), 
      '#default_value' =&gt; $settings['max_length'], 
      '#required' =&gt; TRUE, 
      '#description' =&gt; t('The maximum length of the field in characters.'), 
      '#element_validate' =&gt; array('_element_validate_integer_positive'),
      // @todo: If $has_data, add a validate handler that only allows
      // max_length to increase. 
      '#disabled' =&gt; $has_data,
    );
  }

  return $form;
}