Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
I needed support for the form Synchronize translations (i18n_sync), I made this patch to integrate the synchronization of node weight, works both in the node edit and during the batch update in views.
I check if the i18n_sync module is installed and use his hook
My idea started from the 6.x issue #660052 Weight: sync node translations
Any test is appreciated.
Comment | File | Size | Author |
---|---|---|---|
#2 | translations-1807690-2.patch | 4.14 KB | davisben |
#1 | weight-i18n_sync-1807690.patch | 1.59 KB | bessone |
Comments
Comment #1
bessone CreditAttribution: bessone commentedPatch
Comment #2
davisbenI taken a slightly different approach to this. When getting or setting the weight of a node, we are now checking to see if it is a translation and if it is set the weight equal to the parent node. I made this optional by adding the option to enable it to the weight settings form so it can be turned on or off per content type. If you could test this patch and let me know if it works for you I'd appreciate it.
Comment #3
davisbenI had some time to test this and committed the patch in #2.
Comment #5
rondev CreditAttribution: rondev commentedThere should be a test missing for the patch in #1807690-2: Synchronize translations support. If
$settings
is null($settings['sync_translations'])
creates a bootstrap.There is a test missing confirmed thanks to my Netbeans debugger. If $settings is a null array then there is an error with $settings['sync_translations']. That is why I add a test with
if (empty($settings))
The following code doesn't generate anymore error but it shouldn't be optimal. I don't have the required level in Drupal API and php to optimize it. There is possibly a better solution as there is many possibilities that gives the same
$nid = $node->nid;
.Comment #6
davisbenI am unable to reproduce this error. Could you provide a bit more detail on the steps to reproduce it?
Comment #7
davisbenComment #8
rondev CreditAttribution: rondev commentedDon't know exactly. I didn't search for nodes that create the issue.
Perhaps that can come from one of the language disabled or some translated node but not in every language, only some of them.
Comment #9
rondev CreditAttribution: rondev commentedThat happens with when I use ddblock(Dynamic display block) displaying nodes.
Those nodes have weight disabled and translation enabled.
Comment #10
davisbenI was able to reproduce this and applied the fix from #5.