function webform_service_submission_create in Webform Service 7.4
Same name and namespace in other branches
- 6.3 resources/submission_resource.inc \webform_service_submission_create()
Creates a new submission within a webform.
Note that this function uses drupal_execute() to create new nodes, which may require very specific formatting. The full implications of this are beyond the scope of this comment block. The Googles are your friend.
Parameters
$media: Array representing the attributes a media edit form would submit.
Return value
An associative array contained the new node's nid and, if applicable, the fully qualified URI to this resource.
See also
drupal_execute()
1 string reference to 'webform_service_submission_create'
- _submission_resource_definition in resources/
submission_resource.inc - The submission resource definition.
File
- resources/
submission_resource.inc, line 109
Code
function webform_service_submission_create($uuid, $submission) {
// Get the webform entity.
$webform = webform_service_resource_load($uuid);
// If the entity exists.
if ($webform && $submission) {
module_load_include('inc', 'webform', 'includes/webform.submissions');
$sid = webform_submission_insert($webform, webform_service_parse_submission($webform, $submission));
$saved_submission = webform_get_submission($webform->nid, $sid);
webform_submission_send_mail($webform, $saved_submission);
return webform_service_get_submission($webform, webform_get_submission($webform->nid, $sid, TRUE));
}
else {
return FALSE;
}
}