function access_update_7105 in Access Control Kit 7
Convert access control kit fields to standard list fields.
File
- ./
access.install, line 307 - Install, update and uninstall functions for the access control kit module.
Code
function access_update_7105() {
if (!module_exists('list')) {
module_enable(array(
'list',
));
}
$map = array(
'access_integer' => 'list_integer',
'access_float' => 'list_float',
'access_text' => 'list_text',
'access_boolean' => 'list_boolean',
);
$query = db_select('field_config', 'f');
$query
->fields('f')
->condition('f.type', array_keys($map), 'IN');
$result = $query
->execute();
foreach ($result as $field) {
$update = array();
$update['type'] = $map[$field->type];
$update['module'] = 'list';
$data = unserialize($field->data);
$data['settings'] = array(
'allowed_values' => array(),
'allowed_values_function' => '_access_field_allowed_values',
);
$update['data'] = serialize($data);
db_update('field_config')
->fields($update)
->condition('id', $field->id)
->execute();
}
field_cache_clear(TRUE);
drupal_static_reset('access_scheme_info');
}