You are here

function i18nprofile_translation_field_submit in Internationalization 5.3

Same name and namespace in other branches
  1. 5 i18nprofile/i18nprofile.module \i18nprofile_translation_field_submit()
  2. 5.2 i18nprofile/i18nprofile.module \i18nprofile_translation_field_submit()

Save profile field translation

File

i18nprofile/i18nprofile.module, line 394

Code

function i18nprofile_translation_field_submit($form_id, $form_values) {
  $field = $form_values['source'];
  $values = $form_values['translation'];
  $values['options'] = $values['options'] && $field->type == 'selection' ? serialize($values['options']) : '';
  if (!isset($form_values['current'])) {
    db_query("INSERT INTO {i18n_profile_fields} (fid, language, title,  explanation, options, page) VALUES (%d, '%s', '%s', '%s', '%s', '%s')", $field->fid, $values['language'], $values['title'], $values['explanation'], $values['options'], $values['page']);
    drupal_set_message(t('The field translation has been created.'));
  }
  else {
    db_query("UPDATE {i18n_profile_fields} SET title = '%s', explanation = '%s', options = '%s', page = '%s' WHERE fid = %d AND language = '%s'", $values['title'], $values['explanation'], $values['options'], $values['page'], $values['fid'], $values['language']);
    drupal_set_message(t('The profile field translation has been updated.'));
  }
  cache_clear_all();

  // return 'admin/settings/profile/translation';
}