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' => array(
'field_name' => $fields['field_map_fill_color']['field_name'],
'label' => 'The inactive state colors',
'bundle' => 'nji_map',
'entity_type' => 'node',
'widget' => array(
'type' => 'colorfield_unified_textfield'
),
'description' => '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' => array(
'colorfield_enable_colorpicker' => TRUE,
'colorfield_colorpicker_type' => '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' => array(
'field_name' => $fields['field_map_background_color']['field_name'],
'label' => 'The background color',
'bundle' => 'nji_map',
'entity_type' => 'node',
'description' => 'The background color is the color between.',
'widget' => array(
'type' => 'colorfield_unified_textfield',
),
'instance_settings' => array(
'colorfield_enable_colorpicker' => TRUE,
'colorfield_colorpicker_type' => 'farbtastic',
),
),