You are here

function webform_service_get_resource in Webform Service 6.3

Same name and namespace in other branches
  1. 7.4 webform_service.module \webform_service_get_resource()

Returns a single media resource.

Parameters

$webform: UUID or the whole object of the media we want to return.

Return value

Node object or FALSE if not found.

See also

node_load()

2 calls to webform_service_get_resource()
webform_service_resource_create in resources/webform_resource.inc
Creates a new webform based on submitted values.
webform_service_resource_update in resources/webform_resource.inc
Updates a new webform based on submitted values.
1 string reference to 'webform_service_get_resource'
_webform_resource_definition in resources/webform_resource.inc
The webform resource definition.

File

./webform_service.module, line 155
Webform service module.

Code

function webform_service_get_resource($webform) {
  $resource = array();
  if (gettype($webform) === 'string') {
    $webform = webform_service_resource_load($webform);
  }
  if (is_object($webform)) {
    $uri = services_resource_uri(array(
      'webform',
      $webform->uuid,
    ));
    $resource = (object) array(
      'uri' => services_resource_uri(array(
        'webform',
        $webform->uuid,
      )),
      'uuid' => $webform->uuid,
      'title' => $webform->title,
      'description' => webform_service_field_value($webform, 'body'),
      'created' => $webform->created,
      'updated' => $webform->changed,
      'submissions' => $uri . '/submissions',
      'webform' => webform_service_get_webform($webform),
    );
  }

  // Return the resource.
  return $resource;
}