root / drupal7 / sites / all / modules / i18n / i18n_sync / i18n_sync.api.php @ d719f12f
1 |
<?php
|
---|---|
2 |
/**
|
3 |
* @file
|
4 |
* Synchronization API documentation
|
5 |
*/
|
6 |
|
7 |
/**
|
8 |
* Provide information about which fields to synchronize for each entity type.
|
9 |
*
|
10 |
* @see i18n_sync_options()
|
11 |
*
|
12 |
* Field definitions defined on hook_field_info() may contain a synchronization
|
13 |
* callback used for that field to be synchronized. This callback can be set by:
|
14 |
* $field['i18n_sync_callback'] = 'sychcronize_function_callback
|
15 |
*
|
16 |
* This callback will be invoked with the following parameters
|
17 |
* - $entity_type, $entity, $field, $instance, $langcode, $items, $source_entity, $source_langcode);
|
18 |
*
|
19 |
* @see i18n_sync_field_info_alter()
|
20 |
* @see i18n_sync_field_file_sync()
|
21 |
*
|
22 |
* @return array
|
23 |
* Array of fields indexed by field name that will be presented as options
|
24 |
* to be synchronized. Each element is an array with the following keys:
|
25 |
* - 'title', Field title to be displayed
|
26 |
* - 'description', Field description to be displayed.
|
27 |
* - 'field_name', Field name for configurable Fields.
|
28 |
* - 'group', Group for the UI only to display this field.
|
29 |
*
|
30 |
*/
|
31 |
function hook_i18n_sync_options($entity_type, $bundle_name) { |
32 |
if ($entity_type == 'node') { |
33 |
return array( |
34 |
'parent' => array( |
35 |
'title' => t('Book outline'), |
36 |
'description' => t('Set the translated parent for each translation if possible.') |
37 |
), |
38 |
); |
39 |
} |
40 |
} |
41 |
|
42 |
/**
|
43 |
* Alter information about synchronization options for entities/field
|
44 |
*
|
45 |
* @see hook_i18n_sync_options()
|
46 |
*/
|
47 |
function hook_i18n_sync_options_alter(&$fields, $entity_type, $bundle_name) { |
48 |
|
49 |
} |
50 |
|
51 |
/**
|
52 |
* Perform aditional synchronization on entities
|
53 |
*
|
54 |
* @param $entity_type
|
55 |
* @param $translation
|
56 |
* Translated entity.
|
57 |
* @param $translation_language
|
58 |
* Translated entity language code.
|
59 |
* @param $source
|
60 |
* Source entity.
|
61 |
* @param $source_language
|
62 |
* Source entity language code.
|
63 |
* @param $field_names
|
64 |
* Array of field names to synchronize.
|
65 |
*/
|
66 |
function hook_i18n_sync_translation($entity_type, $translation, $translation_language, $source, $source_language, $field_names) { |
67 |
|
68 |
} |