You are here

function text_update_6000 in Content Construction Kit (CCK) 6

Same name and namespace in other branches
  1. 6.3 modules/text/text.install \text_update_6000()
  2. 6.2 modules/text/text.install \text_update_6000()

Rename widgets to match hook_elements values.

The change in field_types will keep content_update_6000() from correctly updating the module names in the field and instance tables, so do it here.

File

modules/text/text.install, line 50

Code

function text_update_6000() {
  $ret = array();
  $result = db_query("SELECT * FROM {" . content_instance_tablename() . "} WHERE widget_type = 'text'");
  while ($field_instance = db_fetch_array($result)) {
    $widget_settings = unserialize($field_instance['widget_settings']);
    $new_widget_type = $widget_settings['rows'] > 1 ? 'text_textarea' : 'text_textfield';
    $ret[] = update_sql("UPDATE {" . content_instance_tablename() . "} SET widget_module = 'text', widget_type = '" . $new_widget_type . "' WHERE field_name = '{$field_instance['field_name']}' AND type_name = '{$field_instance['type_name']}'");
  }
  content_associate_fields('text');
  return $ret;
}