Hi
I am evaluating D7 and writing a test module in order to help with the learning curve.
Basically its using an Annotate tutorial which allows people to comment on nodes. It adds a comments field to types of my choosing.
Following a tutorial from Apress Pro Drupal 7 Development and tweaking it to suit.
The hook in question is this...
<?php
function script_injector_admin_settings_submit(&$form, $form_state){
$types = $form_state['values']['script_injector_node_types'];
$field = array(
'field_name'=>'script_injector',
'entity_type'=>'node',
'bundle'=>$key,
'label'=>t('Script'),
'widget_type'=>'text_textarea_with_summary',
'settings'=>array('display_summary'=>TRUE),
);
foreach($types as $key => $value){
if($value === 0){
$instance = field_info_instance('node', 'script_injector', $key);
if(!empty($instance)){
field_delete_instance($instance,false);
watchdog("Script Injector", 'Deleted a Script Injector Field from content type: %key', array('%key'=>$key));
}
}else{