function _key_default_process_submitted_key_value in Key 7.3
Default function to process a submitted key value.
Parameters
array $form_state: The form state.
Return value
string The processed key value.
2 string references to '_key_default_process_submitted_key_value'
- textarea_field.inc in plugins/
key_input/ textarea_field.inc - text_field.inc in plugins/
key_input/ text_field.inc
File
- ./
key.module, line 795 - Main Key functionality and hook implementations.
Code
function _key_default_process_submitted_key_value(&$form_state) {
// This is the default behavior. If a field named 'key_value' exists in
// the key input settings, remove it from the settings and return it as
// the submitted value. If the key value is Base64-encoded, decode it and
// return the result as the processed_submitted value. Input plugins can
// override this behavior to perform more complex processing.
$processed_values = array(
'submitted' => NULL,
'processed_submitted' => NULL,
);
$key_input_settings = $form_state['values'];
$key_value_data = $form_state['storage']['key_value'];
if (isset($key_input_settings['key_value'])) {
// If the submitted key value is equal to the obscured value.
if ($key_input_settings['key_value'] == $key_value_data['obscured']) {
// Use the processed original value as the submitted value.
$processed_values['submitted'] = $key_value_data['processed_original'];
}
else {
$processed_values['submitted'] = $key_input_settings['key_value'];
}
if (isset($key_input_settings['base64_encoded']) && $key_input_settings['base64_encoded'] == TRUE) {
$processed_values['processed_submitted'] = base64_decode($processed_values['submitted']);
}
else {
$processed_values['processed_submitted'] = $processed_values['submitted'];
}
unset($key_input_settings['key_value']);
$form_state['values'] = $key_input_settings;
}
return $processed_values;
}