Révision 9faa5de0
Ajouté par Assos Assos il y a presque 3 ans
- ID 9faa5de0ee5c940f7ee0fa98ecd32c0b997b9d0e
- Parent bad4e148
drupal7/sites/all/modules/i18n/i18n_field/i18n_field.module | ||
---|---|---|
176 | 176 |
global $language; |
177 | 177 |
|
178 | 178 |
// Don't translate if the widget is being shown on the field edit form. |
179 |
if ($form_state['build_info']['form_id'] == 'field_ui_field_edit_form') { |
|
179 |
if (isset($form_state['build_info']['form_id']) && $form_state['build_info']['form_id'] == 'field_ui_field_edit_form') {
|
|
180 | 180 |
return; |
181 | 181 |
} |
182 | 182 |
|
... | ... | |
398 | 398 |
* (number or text), values of the array are the display labels. |
399 | 399 |
*/ |
400 | 400 |
function i18n_field_translate_allowed_values($field, $langcode = NULL) { |
401 |
if (!empty($field['settings']['allowed_values'])) { |
|
402 |
return i18n_string_translate(array('field', $field['field_name'], '#allowed_values'), $field['settings']['allowed_values'], array('langcode' => $langcode, 'sanitize' => FALSE)); |
|
403 |
} |
|
404 |
else { |
|
401 |
$allowed_values = list_allowed_values($field); |
|
402 |
if (!$allowed_values) { |
|
405 | 403 |
return array(); |
406 | 404 |
} |
405 |
// Do not attempt to translate options from a callback. |
|
406 |
$function = $field['settings']['allowed_values_function']; |
|
407 |
if (!empty($function) && function_exists($function)) { |
|
408 |
return $allowed_values; |
|
409 |
} |
|
410 |
return i18n_string_translate(array('field', $field['field_name'], '#allowed_values'), $allowed_values, array('langcode' => $langcode, 'sanitize' => FALSE)); |
|
407 | 411 |
} |
408 | 412 |
|
409 | 413 |
/** |
Formats disponibles : Unified diff
Weekly update of contrib modules