function globallink_pd_settings_submit in GlobalLink Connect for Drupal 7.5
Same name and namespace in other branches
- 7.7 globallink_settings.inc \globallink_pd_settings_submit()
- 7.6 globallink_settings.inc \globallink_pd_settings_submit()
Handles submission of globallink_pd_settings form.
File
- ./
globallink_settings.inc, line 186
Code
function globallink_pd_settings_submit($form, &$form_state) {
$op = isset($form_state['values']['op']) ? $form_state['values']['op'] : '';
switch ($op) {
case t('Save PD Settings'):
foreach ($form_state['values'] as $key => $value) {
if (is_array($value) && isset($form_state['values']['array_filter'])) {
$value = array_keys(array_filter($value));
}
variable_set($key, $value);
}
globallink_save_project_names();
drupal_set_message(t('The configuration options have been saved.'));
break;
case t('Save and Test Settings'):
try {
foreach ($form_state['values'] as $key => $value) {
if (is_array($value) && isset($form_state['values']['array_filter'])) {
$value = array_keys(array_filter($value));
}
variable_set($key, $value);
}
globallink_save_project_names();
drupal_set_message(t('Settings Saved and Connection Test Successful.'));
} catch (SoapFault $se) {
watchdog('GlobalLink', 'SOAP Exception - %function - Code[%faultcode], Message[%faultstring]', array(
'%function' => __FUNCTION__,
'%faultcode' => $se->faultcode,
'%faultstring' => $se->faultstring,
), WATCHDOG_ERROR);
form_set_error('', t('Web Services Error: @faultcode - @faultstring', array(
'@faultcode' => $se->faultcode,
'@faultstring' => $se->faultstring,
)));
} catch (Exception $e) {
watchdog('GlobalLink', 'Exception - %function - File[%file], Line[%line], Code[%code], Message[%message]', array(
'%function' => __FUNCTION__,
'%file' => $e
->getFile(),
'%line' => $e
->getLine(),
'%code' => $e
->getCode(),
'%message' => $e
->getMessage(),
), WATCHDOG_ERROR);
form_set_error('', t('Error: @message', array(
'@message' => $e
->getMessage(),
)));
}
break;
}
}