public function RestWSFormatXML::createResource in RESTful Web Services 7.2
Same name and namespace in other branches
- 7 restws.formats.inc \RestWSFormatXML::createResource()
Creates a new resource.
Overrides RestWSBaseFormat::createResource
File
- ./
restws.formats.inc, line 508 - RESTful web services module formats.
Class
- RestWSFormatXML
- A formatter for XML.
Code
public function createResource($resourceController, $data) {
$values = $this
->unserialize($resourceController
->propertyInfo(), $data);
$id = $resourceController
->create($values);
$xml = new DOMDocument('1.0', 'utf-8');
$element = $xml
->createElement('uri');
self::setXMLReference($element, $resourceController
->resource(), $id);
$xml
->appendChild($element);
$function = __FUNCTION__;
drupal_alter('restws_response', $xml, $function, $this->formatName, $resourceController);
return $xml
->saveXML();
}