You are here

function webform_service_resource_update in Webform Service 6.3

Same name and namespace in other branches
  1. 7.4 resources/webform_resource.inc \webform_service_resource_update()

Updates a new webform based on submitted values.

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

$uuid: UUID of the webform we're editing.

$node: Array representing the attributes a node edit form would submit.

Return value

The node's nid.

See also

drupal_execute()

1 string reference to 'webform_service_resource_update'
_webform_resource_definition in resources/webform_resource.inc
The webform resource definition.

File

resources/webform_resource.inc, line 220

Code

function webform_service_resource_update($uuid, $webform) {

  // Load the node if it exists.
  if ($node = webform_service_resource_load($uuid)) {

    // Now update any values.
    webform_service_webform_prepare($webform, $node);

    // Update the webform.
    webform_node_update($node);

    // Return the webform resource that was updated.
    return webform_service_get_resource(node_load($node->nid, NULL, TRUE));
  }
  else {
    return services_error(t('@uuid could not be found', array(
      '@uuid' => $uuid,
    )), 404);
  }
}