function field_encrypt_field_update_field in Field Encryption 7
Implements hook_field_update_field().
File
- ./
field_encrypt.module, line 146 - Core functions for the Field Encryption module.
Code
function field_encrypt_field_update_field($field, $prior_field, $has_data) {
// Encryption is enabled either if the field has no data irrespective of the
// prior settings, or if it has data and the settings are changed from the
// prior settings. This ensures that fields reverted/updated externally will
// always keep the encryption schema modifications.
if (isset($field['settings']['field_encrypt']['encrypt']) && $field['settings']['field_encrypt']['encrypt'] && (!$has_data || (!isset($prior_field['settings']['field_encrypt']['encrypt']) || !$prior_field['settings']['field_encrypt']['encrypt']))) {
module_load_include('inc', 'field_encrypt');
field_encrypt_do_encrypt($field, $has_data);
}
elseif (isset($field['settings']['field_encrypt']['encrypt']) && !$field['settings']['field_encrypt']['encrypt'] && isset($prior_field['settings']['field_encrypt']['encrypt']) && $prior_field['settings']['field_encrypt']['encrypt']) {
module_load_include('inc', 'field_encrypt');
field_encrypt_un_encrypt($field, $has_data);
}
}