Projet

Général

Profil

Révision 599a39cd

Ajouté par Assos Assos il y a environ 3 ans

Weekly update of contrib modules

Voir les différences:

drupal7/sites/all/modules/date/date_tools/date_tools.change_type.inc
10 10
 *
11 11
 * @see date_tools_change_type_form_validate()
12 12
 * @see date_tools_change_type_form_submit()
13
 *
14
 * @todo This is broken, still needs to be adjusted for the D6->D7 changes.
13 15
 */
14 16
function date_tools_change_type_form() {
15 17
  $form = array();
16
  // This is broken, still needs to be adjusted for the D6->D7 changes.
17 18
  drupal_set_message(t('This operation does not yet work for the Drupal 7 version.'), 'error');
18 19
  return $form;
19 20
  $fields = content_fields();
......
31 32
      $date_options[$labels[$field['type']]][$field_name] = t('Field @label (@field_name)', array(
32 33
        '@label' => $field['widget']['label'],
33 34
        '@field_name' => $field_name,
34
        '@type' => $labels[$field['type']]
35
        '@type' => $labels[$field['type']],
35 36
      ));
36 37
    }
37 38
  }
......
94 95
    $labels[$type] = $info['label'];
95 96
  }
96 97

  
97
  // Is there any data in this field? If not, we can
98
  // skip some steps.
98
  // Is there any data in this field? If not, we can skip some steps.
99 99
  $has_data = db_query("SELECT COUNT(*) FROM {" . $table . "}")->fetchField();
100 100

  
101
  // Create a backup copy of the original values.
102
  // The values are going to get corrupted when we
103
  // change the column type.
101
  // Create a backup copy of the original values. The values are going to get
102
  // corrupted when we change the column type.
104 103
  if ($has_data) {
105 104
    $temp_table = $table . '_temp';
106 105
    db_query("CREATE TABLE {" . $temp_table . "} SELECT * FROM {" . $table . "}");
......
115 114
  // If there's no data to update, we're finished.
116 115
  if (!$has_data) {
117 116
    drupal_set_message(t('The field @field_name has been changed from @old_type to @new_type.', array(
118
    '@field_name' => $field['widget']['label'], '@old_type' => $labels[$old_type], '@new_type' => $labels[$new_type])));
117
    '@field_name' => $field['widget']['label'],
118
    '@old_type' => $labels[$old_type],
119
    '@new_type' => $labels[$new_type])));
119 120
    return;
120 121
  }
121 122

  
......
190 191
  drupal_set_message(t('The field @field_name has been changed from @old_type to @new_type.', array(
191 192
    '@field_name' => $field['widget']['label'],
192 193
    '@old_type' => $labels[$old_type],
193
    '@new_type' => $labels[$new_type]
194
    '@new_type' => $labels[$new_type],
194 195
  )));
195 196
}

Formats disponibles : Unified diff