You are here

function date_update_5207 in Date 5.2

Get rid of jscalendar popup widget. Originally update_5201, but that was broken.

File

date/date.install, line 474

Code

function date_update_5207() {
  drupal_load('module', 'content');
  $ret = array();
  if (db_result(db_query("SELECT COUNT(*) FROM {node_field_instance} WHERE widget_type = 'date_js'"))) {
    $replace = module_exists('date_popup') ? 'date_popup' : 'date_text';
    $result = db_query("SELECT field_name, type_name, widget_type from {node_field_instance} where widget_type = 'date_js'");
    while ($widget = db_fetch_array($result)) {
      db_query("UPDATE {node_field_instance} SET widget_type = '{$replace}' WHERE field_name = '%s' AND type_name = '%s'", $widget['field_name'], $widget['type_name']);
    }
    drupal_set_message(t('All date fields using the jscalendar widget have been changed to use the text widget instead, since the jscalendar widget is no longer supported. Enable the Date Popup module to make a jQuery popup calendar available and edit the field settings to select it.'));
    content_clear_type_cache();
  }
  return $ret;
}