You are here

function webform_service_submission_create in Webform Service 6.3

Same name and namespace in other branches
  1. 7.4 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 107

Code

function webform_service_submission_create($uuid, $submission) {

  // Get the webform node.
  $webform = webform_service_resource_load($uuid);

  // If the webform exists.
  if ($webform && $submission) {
    module_load_include('inc', 'webform', 'includes/webform.submissions');
    $sid = webform_submission_insert($webform, webform_service_parse_submission($webform, $submission));
    return webform_service_get_submission($webform, webform_get_submission($webform->nid, $sid, TRUE));
  }
  else {
    return FALSE;
  }
}