I am building a online purchasing system, and I use a Webform to gather clients' personal information.
A problem rises when I want to append some external data (which is not important enough to be included as a field in my registration form) to the webform before the submission.
What should I do? (I used hook_webform_submission_presave()
, but it seems to me that it can only be used to change data, not adding additional data.)
Here's my presave hook; it works, but it's not serving my purpose.
function hook_webform_submission_presave($node, &$submission) {
// Update some component's value before it is saved.
if ($node->nid == 0) {
$component_id = 1;
$submission->data[$component_id]['value'][0] = 'foo';
}
}