You need your own form ideally, right now you have a system_settings_form
. That's typically for only setting variables
and really simple stuff like that. see the documentation on system_settings_forms.
Instead you probably want to create and use a custom menu callback (you've already done that) which has a callback to a custom form you've defined. See the general drupal FAPI guide.
With your own form you create a submit callback. In that callback you take the selected node types and just create and assign instances of drupal fields to them. So you have to do 2 things: 1) create the fields, 2) assign them to the content types (entity bundles).
The form submit callback could look like this (not 100% tested code, fill in the blanks, add validation, etc):
function mymodule_form_submit($form, &$form_state) {
if (!field_info_field('field_price')) {
# Create field singleton
$field = array('field_name' => 'field_price', 'type' => 'number_decimal',);
$field = field_create_field($field);
}
if (!field_info_field('field_price')) {
# Create field singleton
$field2 = array('field_name' => 'field_type_of_currency', 'type' => 'option',);
$field2 = field_create_field($field2);
}
foreach ($form_state['values']['content_type'] as $machine_id => $machine_name) {
# Create instance on bundle.
$instance['field_price'] = array(
'field_name' => $field['field_name'],
'entity_type' => 'node',
'bundle' => $machine_id,
'label' => 'Price',
'description' => 'The price of an item.',
'required' => FALSE,
'settings' => array(),
'widget' => array(
'type' => 'textfield',
),
'display' => array(
'default' => array('label' => 'hidden'),
),
);
// ... same instance code for currancy type field instance.
// $instance['field_currency_type'] = ...;
foreach ($instance as $instance_field){
field_create_instance($instance_field);
}
}
}