You are here

function globallink_field_submit in GlobalLink Connect for Drupal 7.6

Same name and namespace in other branches
  1. 7.7 globallink_field_configuration.inc \globallink_field_submit()
  2. 7.5 globallink_field_configuration.inc \globallink_field_submit()

Handles submission of globallink_field form.

File

./globallink_field_configuration.inc, line 313
globallink_field_configuration.inc is a file that contains most functions needed on the Field Configuration UI.

Code

function globallink_field_submit($form, &$form_state) {
  $op = isset($form_state['values']['op']) ? $form_state['values']['op'] : '';
  switch ($op) {
    case t('Go'):
      $_SESSION['globallink_selected_content_type'] = $form_state['values']['select_type'];
      break;
    case t('Update'):
      $type = $form_state['values']['select_type'];
      $fids = array_filter($form_state['values']['table']);
      globallink_update_gl_field_config($type, $fids);
      $state = isset($form_state['input']['state']) ? $form_state['input']['state'] : FALSE;
      if ($state) {
        variable_set('globallink_moderation_' . $type, $state);
      }
      drupal_set_message(t('Field configurations have been saved successfully.'));
      break;
    case t('Add'):
      $field = $form_state['values']['pending_fields'];
      globallink_insert_gl_field_config($field, $_SESSION['globallink_selected_content_type'], $form_state['values']['select_entity_type']);
      drupal_set_message(t('Field configurations have been added successfully.'));
      break;
  }
}