function encrypt_config_form_submit in Encrypt 7.2
Same name and namespace in other branches
- 7.3 includes/encrypt.admin.inc \encrypt_config_form_submit()
Form submission handler for encrypt_config_form().
1 string reference to 'encrypt_config_form_submit'
- encrypt_config_form in includes/
encrypt.admin.inc - Form constructor for the configuration edit form.
File
- includes/
encrypt.admin.inc, line 348 - This file holds the functions for the Encrypt admin settings.
Code
function encrypt_config_form_submit($form, &$form_state) {
$method = encrypt_get_encryption_method($form_state['values']['encrypt_encryption_method']);
$key_provider = encrypt_get_key_provider($form_state['values']['encrypt_key_provider']);
foreach (array(
$method,
$key_provider,
) as $plugin) {
if ($submit_callback = ctools_plugin_get_function($plugin, 'submit callback')) {
// Create a copy so that the plugin callback cannot change the
// form state.
$form_state_copy = $form_state;
call_user_func($submit_callback, $form, $form_state_copy);
}
}
$fields = array(
'name' => (string) $form_state['values']['name'],
'label' => (string) $form_state['values']['label'],
'description' => (string) $form_state['values']['description'],
'method' => (string) $form_state['values']['encrypt_encryption_method'],
'provider' => (string) $form_state['values']['encrypt_key_provider'],
'enabled' => (int) $form_state['values']['enabled'],
'created' => $form_state['values']['created'],
);
if (empty($form_state['values']['encrypt_encryption_methods_' . $fields['method'] . '_settings'])) {
$fields['method_settings'] = '';
}
else {
$fields['method_settings'] = $form_state['values']['encrypt_encryption_methods_' . $fields['method'] . '_settings'];
}
if (empty($form_state['values']['encrypt_key_providers_' . $fields['provider'] . '_settings'])) {
$fields['provider_settings'] = '';
}
else {
$fields['provider_settings'] = $form_state['values']['encrypt_key_providers_' . $fields['provider'] . '_settings'];
}
encrypt_save_config($fields);
$form_state['redirect'] = ENCRYPT_MENU_PATH . '/list';
}