updated i18n i10n_update workflwo imachecache_actions

This commit is contained in:
2020-06-23 12:41:21 +02:00
parent 8c39ab6f4a
commit 092758ecb0
134 changed files with 2894 additions and 1205 deletions
@@ -3,7 +3,7 @@ README.txt
==========
Drupal module: i18n_sync (Synchronization)
This module will handle content synchronization accross translations.
This module will handle content synchronization across translations.
The available list of fields to synchronize will include standard node fields and cck fields.
To have aditional fields, add the list in a variable in the settings.php file, like this:
@@ -1,5 +1,5 @@
name = Synchronize translations
description = Synchronizes taxonomy and fields accross translations of the same content.
description = Synchronizes taxonomy and fields across translations of the same content.
dependencies[] = i18n
dependencies[] = translation
package = Multilingual - Internationalization
@@ -10,9 +10,8 @@ files[] = i18n_sync.install
files[] = i18n_sync.module.inc
files[] = i18n_sync.node.inc
files[] = i18n_sync.test
; Information added by Drupal.org packaging script on 2017-01-31
version = "7.x-1.15"
; Information added by Drupal.org packaging script on 2020-06-17
version = "7.x-1.27"
core = "7.x"
project = "i18n"
datestamp = "1485834792"
datestamp = "1592373390"
@@ -33,7 +33,7 @@ function i18n_sync($status = NULL) {
function i18n_sync_help($path, $arg) {
switch ($path) {
case 'admin/help#i18n_sync' :
$output = '<p>' . t('This module synchronizes content taxonomy and fields accross translations:') . '</p>';
$output = '<p>' . t('This module synchronizes content taxonomy and fields across translations:') . '</p>';
$output .= '<p>' . t('First you need to select which fields should be synchronized. Then, after a node has been updated, all enabled vocabularies and fields will be synchronized as follows:') . '</p>';
$output .= '<ul>';
$output .= '<li>' . t('All the node fields selected for synchronization will be set to the same value for all translations.') . '</li>';
@@ -91,6 +91,7 @@ function i18n_sync_form_node_type_form_alter(&$form, &$form_state) {
$form['i18n_sync']['i18n_sync_node_type'] = array(
'#tree' => TRUE,
'#weight' => 1,
);
// Each set provides title and options. We build a big checkboxes control for it to be
@@ -121,6 +122,21 @@ function i18n_sync_form_node_type_form_alter(&$form, &$form_state) {
);
}
}
// Add option to restrict syncing only when editing the translation source.
$form['i18n_sync']['i18n_sync_source_description'] = array(
'#prefix' => '<div>', '#suffix' => '</div>',
'#markup' => t('Restrict synchronization to the translation source.'),
'#weight' => 2,
);
$form['i18n_sync']['i18n_sync_source'] = array(
'#type' => 'checkbox',
'#title' => t('Synchronize translations only when saving the translation source'),
'#default_value' => variable_get('i18n_sync_source_' . $type, FALSE),
'#disabled' => $disabled,
'#weight' => 3,
'#description' => t('If not checked each node will trigger the synchronization, whether it\'s the source or not.'),
);
}
}
@@ -167,9 +183,17 @@ function i18n_sync_node_insert($node) {
*/
function i18n_sync_node_update($node) {
// Let's go with field synchronization.
if (i18n_sync_node_check($node) && !empty($node->tnid) && ($fields = i18n_sync_node_fields($node->type)) && ($translations = i18n_sync_node_get_translations($node, TRUE))) {
module_load_include('node.inc', 'i18n_sync');
i18n_sync_node_translation($node, $translations, $fields, 'update');
if (i18n_sync_node_check($node) && !empty($node->tnid) && (!variable_get('i18n_sync_source_' . $node->type, TRUE) || $node->tnid == $node->nid) && ($fields = i18n_sync_node_fields($node->type)) && ($translations = i18n_sync_node_get_translations($node, TRUE))) {
$do_sync = TRUE;
if (module_exists('entity_translation')) {
if (entity_translation_enabled_bundle('node', $node->type)) {
$do_sync = FALSE;
}
}
if ($do_sync) {
module_load_include('node.inc', 'i18n_sync');
i18n_sync_node_translation($node, $translations, $fields, 'update');
}
}
}
@@ -98,7 +98,7 @@ function i18n_sync_node_translation_nodereference_field(&$node, &$translation, $
* Example:
* English A references English B and English C.
* English A and B are translated to German A and B, but English C is not.
* The syncronization from English A to German A would it German B and English C.
* The synchronization from English A to German A would it German B and English C.
*/
function i18n_sync_node_translation_reference_field(&$reference_node, $default_value, $langcode) {
if (isset($reference_node->tnid) && translation_supported_type($reference_node->type)) {