External modules use the $form['details'] array to help manage data upon submission.
Webform fills this array in webform_client_form(), adding a lot of information like "nid".
Modules like webform_validation use this data to perform actions.
When using a "single webform across a translation set", external modules will use the $form['details']['nid'] value, which will be wrong on translations.
A universal solution is needed, you can't request every module to integrate with webform_localization
My suggestions is filling it up with the nid value from the (source) webform. For performance reasons I wouldn't do a check.. I don't think anything can go wrong when overwriting with an identical value ;)
/**
* Implements hook_form_webform_client_form_alter().
*/
function webform_localization_form_webform_client_form_alter(&$form, &$form_state, $form_id) {
if (isset($form['details']['nid']['#value']) && isset($form['#node']->webform['nid'])) {
$form['details']['nid']['#value'] = $form['#node']->webform['nid'];
}
}
The above snippet fixes it.
(fyi: i have not rolled a patch for this simple fix, as the version i'm using contains a lot of patches from this issue queue that still need to be committed, please consider reviewing older patches in the queue)
Comments
Comment #1
GDrupal commented@rv0 What do you think about adding the tnid to the $form['details'] array...
http://drupalcode.org/project/webform_localization.git/commit/9149663
Comment #2
rv0 commentedadding the tnid will not fix external modules that rely on a correct nid (webform_validation as an example)
this matters when using "single webform across a translation set" setting.
Comment #3
GDrupal commentedI think this http://drupalcode.org/project/webform_localization.git/commit/af21a49
will solve that for good. Thanks @rv0