function i18n_field_update_7000 in Internationalization 7
Implements hook_i18n_drupal6_update().
Update old string names
1 call to i18n_field_update_7000()
- i18n_field_install in i18n_field/
i18n_field.install - Implements hook_install().
File
- i18n_field/
i18n_field.install, line 34 - Install, update and uninstall functions for the i18n_field module.
Code
function i18n_field_update_7000() {
// @todo
module_load_install('i18n_string');
// Old CCK label and description
$query = db_select('i18n_string', 's')
->fields('s')
->condition('textgroup', 'cck')
->condition('type', 'field');
foreach ($query
->execute() as $string) {
$string->textgroup = 'field';
list($bundle, $field) = explode('-', $string->objectid);
$string->type = $field;
$string->objectid = $bundle;
$string->property = str_replace('widget_', '', $string->property);
i18n_string_install_update_string($string);
}
// @todo Field groups ??
// Old Profile fields
$query = db_select('i18n_string', 's')
->fields('s')
->condition('textgroup', 'profile')
->condition('type', 'field');
foreach ($query
->execute() as $string) {
$string->textgroup = 'field';
$string->type = $string->property;
if ($string->objectid == 'options') {
// @todo Handle field options
$string->objectid = '#allowed_values';
}
else {
$string->objectid = 'user';
// Bundle for profile fields
i18n_string_install_update_string($string);
}
}
// @todo Profile categories ??
}