function smtp_admin_provider_settings_submit in SMTP Authentication Support 7.2
Submit handler().
Parameters
form: An associative array containing the structure of the form.
form_state: A keyed array containing the current state of the form.
File
- ./
smtp.admin.inc, line 547 - Administrative page code for the smtp module.
Code
function smtp_admin_provider_settings_submit($form, &$form_state) {
$providers = variable_get('smtp_providers', array());
// Parse the form fields inside a variable
$provider = array(
'name' => $form_state['values']['name'],
'machine_name' => $form_state['values']['machine_name'],
);
foreach ($form_state['values'] as $key => $value) {
if (substr($key, 0, 5) == 'smtp_') {
$provider[$key] = $value;
}
}
// If it exists, remove the previous configuration
unset($providers[$form_state['values']['machine_name']]);
// Add it to the providers variable and save
$providers[$provider['machine_name']] = $provider;
variable_set('smtp_providers', $providers);
// Go back to the configuration form
drupal_goto("admin/config/system/smtp");
}