root / drupal7 / sites / all / modules / i18n / i18n_field / i18n_field.api.php @ 9faa5de0
1 | 85ad3d82 | Assos Assos | <?php
|
---|---|---|---|
2 | |||
3 | /**
|
||
4 | * @file
|
||
5 | * API documentation file for Field translation module.
|
||
6 | *
|
||
7 | * This module takes care of translating common field elements like title and
|
||
8 | * description for all fields, plus some field specific values (default, options)
|
||
9 | * for field types defined by Drupal core.
|
||
10 | *
|
||
11 | * Before implementing any of these hooks, consider whether you would be better
|
||
12 | * off implementing Drupal core's hook_field_widget_form_alter().
|
||
13 | *
|
||
14 | * @see i18n_field_field_widget_form_alter()
|
||
15 | */
|
||
16 | |||
17 | /**
|
||
18 | * Provide information about callbacks for translating specific field types.
|
||
19 | *
|
||
20 | * This information can be retrieved using i18n_field_type_info().
|
||
21 | * @return
|
||
22 | * Array of values indexed by field type. Valid keys are:
|
||
23 | * - 'translate_default', Callback for translating the default value for this field type.
|
||
24 | * - 'translate_options', Callback for translating options for this field type.
|
||
25 | *
|
||
26 | * @see i18n_field_type_info()
|
||
27 | * @see i18n_field_i18n_field_info()
|
||
28 | *
|
||
29 | * For examples of both callback types:
|
||
30 | *
|
||
31 | * @see i18n_field_translate_allowed_values()
|
||
32 | * @see i18n_field_translate_default()
|
||
33 | *
|
||
34 | */
|
||
35 | function hook_i18n_field_info() { |
||
36 | $info['text'] = $info['text_long'] = $info['text_with_summary'] = array( |
||
37 | 'translate_default' => 'i18n_field_translate_default', |
||
38 | ); |
||
39 | $info['list_text'] = $info['list_boolean'] = $info['list_integer'] = array( |
||
40 | 'translate_options' => 'i18n_field_translate_allowed_values', |
||
41 | ); |
||
42 | return $info; |
||
43 | } |
||
44 | |||
45 | /**
|
||
46 | * Alter information provided by hook_i18n_field_info().
|
||
47 | *
|
||
48 | * @see i18n_field_type_info()
|
||
49 | */
|
||
50 | function hook_i18n_field_info_alter(&$info) { |
||
51 | // Unset the default callback for text fields.
|
||
52 | unset($info['text']['translate_default']); |
||
53 | } |