function ldap_servers_admin_form_submit in Lightweight Directory Access Protocol (LDAP) 8.2
Same name and namespace in other branches
- 7.2 ldap_servers/ldap_servers.admin.inc \ldap_servers_admin_form_submit()
- 7 ldap_servers/ldap_servers.admin.inc \ldap_servers_admin_form_submit()
Submit hook for the LDAP server form.
File
- ldap_servers/
ldap_servers.admin.inc, line 84 - Defines functions for administrative interface for servers
Code
function ldap_servers_admin_form_submit($form, &$form_state) {
$button = drupal_strtolower($form_state['clicked_button']['#value']);
$op = $button == 'add' ? 'add' : 'edit';
$verb = $op == 'edit' ? 'edited' : $op . 'ed';
ldap_servers_module_load_include('php', 'ldap_servers', 'LdapServerAdmin.class');
$server = new LdapServerAdmin($form_state['values']['sid']);
$server
->drupalFormSubmit($op, $form_state['values']);
// add form data to object and save or create
if ($server
->hasError() == FALSE) {
drupal_set_message(t('LDAP Server %name !verb.', array(
'!verb' => $verb,
'%name' => $server->name,
)), 'status');
ldap_servers_cache_clear();
if ($form_state['ldap_warnings'] && $op != 'add') {
// do nothing, but don't redirect away from form.
// if there are warnings, want them to see form even if its been saved
}
else {
drupal_goto(LDAP_SERVERS_MENU_BASE_PATH . '/servers');
}
}
else {
form_set_error($server
->errorName(), $server
->errorMsg());
$server
->clearError();
}
ldap_servers_cache_clear();
}