You are here

function key_provider_lockr_set_key_value in Lockr 7.2

Same name and namespace in other branches
  1. 7.3 plugins/key_provider/lockr.inc \key_provider_lockr_set_key_value()
  2. 7 plugins/key_provider/lockr.inc \key_provider_lockr_set_key_value()

Set callback for key_provider plugin.

1 string reference to 'key_provider_lockr_set_key_value'
lockr.inc in plugins/key_provider/lockr.inc
Key provider plugin for lockr.

File

plugins/key_provider/lockr.inc, line 84
Key provider plugin for lockr.

Code

function key_provider_lockr_set_key_value($config, &$form_state, $key_value) {
  $name = $config['id'];
  $label = $config['label'];
  $old_encoded = NULL;
  if (isset($form_state['storage']['original_key']['key_provider_settings']['encoded'])) {
    $old_encoded = $form_state['storage']['original_key']['key_provider_settings']['encoded'];
  }
  $new_encoded = _lockr_set_key($name, $key_value, $label, $old_encoded);
  if (!$new_encoded) {
    form_set_error('', t('An error occurred in Lockr. Please try again in a moment.'));
  }
  else {
    $form_state['values']['encoded'] = $new_encoded;
  }
}