function clients_connection_form_submit in Web Service Clients 7
Same name and namespace in other branches
- 6.2 clients.connection.admin.inc \clients_connection_form_submit()
- 7.3 includes/clients.connection.admin.inc \clients_connection_form_submit()
- 7.2 clients.connection.admin.inc \clients_connection_form_submit()
Common submit handler for connection add and edit forms.
Gets the class of the connection from the data in the form and calls the connectionSettingsForm_submit() method on the class. This allows different behaviour for different connection types.
See also
2 string references to 'clients_connection_form_submit'
- clients_connection_add in ./
clients.connection.admin.inc - Form builder for adding a connection.
- clients_connection_edit in ./
clients.connection.admin.inc - Form builder for editing a connection.
File
- ./
clients.connection.admin.inc, line 186 - clients.connection.admin.inc Page callbacks relating to client connection admin.
Code
function clients_connection_form_submit($form, &$form_state) {
//dsm($form);
//dsm($form_state);
$class = $form['#connection_class'];
// Use call_user_func_array() so form state can be passed by reference.
call_user_func_array(array(
$class,
'connectionSettingsForm_submit',
), array(
$form,
&$form_state,
));
// Common actions for all forms.
// Presence of the cid tells us whether we're editing or adding a new connection.
$new = !isset($form_state['values']['cid']);
if ($new) {
drupal_write_record('clients_connections', $form_state['values']);
}
else {
drupal_write_record('clients_connections', $form_state['values'], 'cid');
}
drupal_set_message(t('Connection saved.'));
$form_state['redirect'] = 'admin/settings/clients/connections';
}