You are here

function abt_update_7002 in Access By Term 7

Convert from abt_map to field_config.

File

./abt.install, line 65
abt.install Install, update and uninstall functions for the ABT module.

Code

function abt_update_7002() {
  $access_map = db_select('abt_map', 'a')
    ->fields('a')
    ->execute();
  while ($realm = $access_map
    ->fetchAssoc()) {
    $field = field_info_field($realm['field_name']);
    $field_abt_map = array(
      'ctrl_view_access' => $realm['ctrl_view_access'],
      'ctrl_update_access' => $realm['ctrl_update_access'],
      'ctrl_delete_access' => $realm['ctrl_delete_access'],
    );
    $field['settings']['abt_map'] = $field_abt_map;
    field_update_field($field);
  }
  db_drop_table('abt_map');
}