function field_encrypt_form_system_modules_alter in Field Encryption 7
Implements hook_form_FORM_ID_alter().
File
- ./
field_encrypt.module, line 111 - Core functions for the Field Encryption module.
Code
function field_encrypt_form_system_modules_alter(&$form, &$form_state) {
// Find all the fields that are currently being encrypted.
$fields = array();
foreach (field_info_fields() as $field_name => $field_info) {
if (!isset($field_info['settings']['field_encrypt']['encrypt'])) {
continue;
}
if (!$field_info['settings']['field_encrypt']['encrypt']) {
continue;
}
$fields[] = l(check_plain($field_name), 'admin/reports/fields');
}
// If there are any encrypted fields, prevent the module from being disabled.
if (!empty($fields)) {
$field_list = theme('item_list', array(
'items' => $fields,
));
$form['modules']['Fields']['field_encrypt']['enable']['#disabled'] = TRUE;
$form['modules']['Fields']['field_encrypt']['#required_by'][] = t('Encrypted fields: <span class="admin-enabled">!fields</span>.', array(
'!fields' => $field_list,
));
}
}