You are here

function filefield_update_6100 in FileField 6.3

Migrate field settings from 'force_list_default' and 'show_description'.

File

./filefield.install, line 204

Code

function filefield_update_6100() {
  $ret = array();
  module_load_include('inc', 'content', 'includes/content.crud');
  $fields = content_fields();
  foreach ($fields as $field) {
    if ($field['type'] == 'filefield') {
      if (isset($field['force_list_default'])) {
        $field['list_field'] = !$field['force_list_default'];
      }
      if (isset($field['show_description'])) {
        $field['description_field'] = $field['show_description'];
      }
      _content_field_write($field);
      $ret[] = array(
        'success' => TRUE,
        'query' => t('The file field %field has been updated with new settings.', array(
          '%field' => $field['field_name'],
        )),
      );
    }
  }
  cache_clear_all('*', content_cache_tablename(), TRUE);
  cache_clear_all('*', 'cache', TRUE);
  return $ret;
}