I can create content type fields pragmatically, but I set het widget options too? Im using field_create_instance to create all my defined fields, and use the correct field types and widget types and such, but Im not sure how to set the widget options.

In my use case, Im using the colorfield module and am trying to save the default options for the widget so the content type automagically uses farbtastic but I'm not the greatest drupal dev yet and am not sure how to do that.

Right now, my instance looks like:

'fill_color' =&gt; array(
    'field_name' =&gt; $fields['field_map_fill_color']['field_name'],
    'label' =&gt; 'The inactive state colors',
    'bundle' =&gt; 'nji_map',
    'entity_type' =&gt; 'node',
    'widget'      =&gt; array(
        'type'    =&gt; 'colorfield_unified_textfield'
    ),
    'description' =&gt; 'This is the color of the inactive color of the state.',

),


So that sets the field to use the colorfield field widget alright, but I need to set it up so it also uses the farbtastic option. I took a look at the module and theres a hook called hook_field_info with this option:

    'instance_settings' =&gt; array(
        'colorfield_enable_colorpicker' =&gt; TRUE,
        'colorfield_colorpicker_type' =&gt; 'farbtastic',
    ),


I looked at the drupal field_create_instance hook and i feel like it needs to go into widget->type right? Well I cant seem to get it to work.

Ive also tried:

    'background_color' =&gt; array(
        'field_name' =&gt; $fields['field_map_background_color']['field_name'],
        'label' =&gt; 'The background color',
        'bundle' =&gt; 'nji_map',
        'entity_type' =&gt; 'node',
        'description' =&gt; 'The background color is the color between.',
        'widget'      =&gt; array(
            'type'    =&gt; 'colorfield_unified_textfield',
        ),

        'instance_settings' =&gt; array(
            'colorfield_enable_colorpicker' =&gt; TRUE,
            'colorfield_colorpicker_type' =&gt; 'farbtastic',
        ),

    ),
I think it should look like this :

    'field_instance' =&gt; array(
  'bundle' =&gt; 'fo',
  'default_formatter' =&gt; 'text_default',
  'default_value' =&gt; NULL,
  'default_widget' =&gt; 'text_textfield',
  'deleted' =&gt; '0',
  'description' =&gt; 'blah blah blah.',
  'display' =&gt; array(
    'default' =&gt; array(
      'label' =&gt; 'above',
      'module' =&gt; 'text',
      'settings' =&gt; array(),
      'type' =&gt; 'text_default',
      'weight' =&gt; 0,
    ),
  ),
  'entity_type' =&gt; 'taxonomy_term',
  'field_name' =&gt; 'test',
  'instance_settings' =&gt; array(
    'text_processing' =&gt; 0,
  ),
  'label' =&gt; ' test',
  'required' =&gt; FALSE,
  'settings' =&gt; array(
    'max_length' =&gt; 255,
    'text_processing' =&gt; 0,
    'user_register_form' =&gt; FALSE,
  ),
  'title' =&gt; 'test',
  'widget' =&gt; array(
    'module' =&gt; 'text',
    'settings' =&gt; array(
      'size' =&gt; 60,
    ),
    'type' =&gt; 'text_textfield',
    'weight' =&gt; 31,
  ),
),