function encrypt_config_make_default in Encrypt 7.2
Same name and namespace in other branches
- 7.3 includes/encrypt.admin.inc \encrypt_config_make_default()
Menu callback to make a configuration the default.
1 string reference to 'encrypt_config_make_default'
- encrypt_menu in ./
encrypt.module - Implements hook_menu().
File
- includes/
encrypt.admin.inc, line 441 - This file holds the functions for the Encrypt admin settings.
Code
function encrypt_config_make_default($config) {
variable_set('encrypt_default_config', $config['name']);
$default_config = variable_get('encrypt_default_config', NULL);
$t_args = array(
'%label' => $config['label'],
);
if ($default_config == $config['name']) {
// If the configuration is not enabled and it's the new default, enable it.
if (!$config['enabled']) {
db_update('encrypt_config')
->fields(array(
'enabled' => 1,
))
->condition('name', $config['name'])
->execute();
drupal_set_message(t('The configuration %label has been enabled.', $t_args));
watchdog('node', 'Enabled encryption configuration %label.', $t_args, WATCHDOG_NOTICE);
}
drupal_set_message(t('The configuration %label has been made the default.', $t_args));
watchdog('encrypt', 'Made encryption configuration %label the default.', $t_args, WATCHDOG_NOTICE);
}
else {
drupal_set_message(t('The configuration %label could not be made the default.', $t_args), 'error');
watchdog('encrypt', 'Error when trying to make encryption configuration %label the default.', $t_args, WATCHDOG_ERROR);
}
drupal_goto(ENCRYPT_MENU_PATH);
}