summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--i18n_field/i18n_field.module34
1 files changed, 17 insertions, 17 deletions
diff --git a/i18n_field/i18n_field.module b/i18n_field/i18n_field.module
index c36dbb0..b4a8676 100644
--- a/i18n_field/i18n_field.module
+++ b/i18n_field/i18n_field.module
@@ -3,10 +3,10 @@
/**
* @file
* Internationalization (i18n) module - Field handling
- *
+ *
* Notes:
* - Field titles are already translated with t(), which is a pity, but nothing to do here
- *
+ *
* For string keys we use:
* - field:[field_name]:[bundle]:property, when it is an instance property (linked to bundle)
* - field:[field_name]:#property..., when it is a field property (that may have multiple values)
@@ -34,7 +34,7 @@ function i18n_field_i18n_string_list($group) {
foreach (field_read_fields() as $field) {
if (!empty($field['settings']['allowed_values']) && i18n_field_type_info($field['type'], 'translate_options')) {
$strings['field'][$field['field_name']]['#allowed_values'] = $field['settings']['allowed_values'];
- }
+ }
}
foreach (field_read_instances() as $instance) {
$add = array(
@@ -53,12 +53,12 @@ function i18n_field_i18n_string_list($group) {
$strings['field'][$instance['field_name']][$instance['bundle']] = $add;
}
return $strings;
- }
+ }
}
/**
* Implements hook_field_attach_form().
- *
+ *
* After the form fields are built
*/
function i18n_field_field_attach_form($entity_type, $entity, $form, $form_state, $langcode) {
@@ -66,7 +66,7 @@ function i18n_field_field_attach_form($entity_type, $entity, $form, $form_state,
/**
* Implements hook_field_info_alter().
- *
+ *
* Cached, invoked only after field info is rebuilt
*/
function i18n_field_field_info_alter(&$info) {
@@ -123,7 +123,7 @@ function i18n_field_field_formatter_view($entity_type, $entity, $field, $instanc
/**
* Implements hook_field_widget_info_alter()
- *
+ *
* Cached, invoked only after widget info is rebuilt
*/
function i18n_field_field_widget_info_alter(&$info) {
@@ -131,7 +131,7 @@ function i18n_field_field_widget_info_alter(&$info) {
/**
* Implements hook_field_widget_properties_alter().
- *
+ *
* This is called for the entity edit form and for the fields edit form
*/
function i18n_field_field_widget_properties_alter(&$widget, $context) {
@@ -143,12 +143,12 @@ function i18n_field_field_widget_properties_alter(&$widget, $context) {
}
function i18n_field_field_extra_fields_display_alter(&$displays, $context) {
-
+
}
/**
* Implements hook_field_display_alter().
- *
+ *
* Called only when refreshing cache
*/
function i18n_field_field_display_alter(&$display, $context) {
@@ -161,7 +161,7 @@ function i18n_field_field_storage_info_alter(&$info) {
/**
* Field API callback to rewrite field element
- *
+ *
* Translate:
* - Description (help)
* - Default value
@@ -170,7 +170,7 @@ function i18n_field_field_storage_info_alter(&$info) {
function i18n_field_field_widget_form($form, $form_state, $field, $instance, $langcode, $items, $delta, $element) {
global $language;
// The field language may affect some variables (default) but not others (description will be in current page language)
- $langcode = empty($element['#language']) || $element['#language'] == LANGUAGE_NONE ? $language->language : $element['#language'];
+ $langcode = empty($element['#language']) || $element['#language'] == LANGUAGE_NONE ? $language->language : $element['#language'];
$delta = $element['#delta'];
$translate = array(
@@ -179,12 +179,12 @@ function i18n_field_field_widget_form($form, $form_state, $field, $instance, $la
);
foreach ($translate as $property => $options) {
-
+
}
// Translate field description if set
if (!empty($instance['description'])) {
$element['#description'] = i18n_field_translate_property($instance, 'description');
- }
+ }
// Translate default value if exists and the current value is the default
if (($translate = i18n_field_type_info($field['type'], 'translate_default')) && !empty($instance['default_value'][$delta]['value']) && !empty($items[$delta]['value']) && $instance['default_value'][$delta]['value'] === $items[$delta]['value']) {
$items[$delta]['value'] = $translate($instance, $items[$delta]['value'], $langcode);
@@ -221,7 +221,7 @@ function i18n_field_field_create_instance($instance) {
*/
function i18n_field_field_delete_instance($instance) {
foreach (array('description', 'default_value') as $property) {
- i18n_string_remove(array('field', $instance['bundle'], $instance['field_name'], $property));
+ i18n_string_remove(array('field', $instance['field_name'], $instance['bundle'], $property));
}
}
@@ -246,7 +246,7 @@ function i18n_field_field_update_strings($field) {
// For select fields field:field_name
if (!empty($field['settings']['allowed_values']) && i18n_field_type_info($field['type'], 'translate_options')) {
i18n_string_update(array('field', $field['field_name'],'#allowed_values'), $field['settings']['allowed_values']);
- }
+ }
}
/**
@@ -332,4 +332,4 @@ function i18n_field_i18n_field_info() {
'translate_options' => 'i18n_field_translate_allowed_values',
);
return $info;
-} \ No newline at end of file
+}