You are here

function webform_service_resource_create in Webform Service 7.4

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

Creates 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

$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_resource_create'
_webform_resource_definition in resources/webform_resource.inc
The webform resource definition.

File

resources/webform_resource.inc, line 195

Code

function webform_service_resource_create($webform, $type) {
  module_load_include('inc', 'services', 'resources/node_resource');
  $webform['type'] = $type;

  // Make sure we have a webform object.
  if (!isset($webform['webform'])) {
    $webform['webform'] = array();
  }

  // Prepare and create a new node.
  $node = _node_resource_create(webform_service_webform_prepare($webform));

  // Return the webform resource that was created.
  return webform_service_get_resource(node_load($node['nid'], NULL, TRUE));
}