function globallink_field_submit in GlobalLink Connect for Drupal 7.7
Same name and namespace in other branches
- 7.5 globallink_field_configuration.inc \globallink_field_submit()
- 7.6 globallink_field_configuration.inc \globallink_field_submit()
Handles submission of globallink_field form.
File
- ./
globallink_field_configuration.inc, line 392 - 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'];
$select_entity_type = $form_state['values']['select_entity_type'];
$fids = array_filter($form_state['values']['table']);
if ($select_entity_type == 'custom_entity' && globallink_starts_with($type, 'ce:')) {
$selected_type = str_replace('ce:', '', $type);
$bundle = globallink_get_bundle_for_field($selected_type);
globallink_update_gl_field_config($bundle, $fids);
}
else {
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;
}
}