You are here

function og_ui_field_settings_submit in Organic groups 7

Same name and namespace in other branches
  1. 7.2 og_ui/og_ui.admin.inc \og_ui_field_settings_submit()

File

og_ui/og_ui.admin.inc, line 811
Admin settings for Organic groups module.

Code

function og_ui_field_settings_submit($form, &$form_state) {
  $bundle = preg_replace('/^.*__/i', '', $form_state['values']['bundles']);
  $entity_type = str_replace('__' . $bundle, '', $form_state['values']['bundles']);
  $field_name = $form_state['values']['fields'];
  og_create_field($field_name, $entity_type, $bundle);
  $group_field = og_fields_info($field_name);
  $bundles = field_info_bundles($entity_type);
  $params = array(
    '%field' => $group_field['instance']['label'],
    '%bundle' => $bundles[$bundle]['label'],
  );
  drupal_set_message(t('Added field %field to %bundle.', $params));
}