Browse Source

Can add basic images as children of collections

7.x-2.x
Daniel Lamb 10 years ago
parent
commit
ed54676137
  1. 17
      islandora_basic_image/islandora_basic_image.module

17
islandora_basic_image/islandora_basic_image.module

@ -101,6 +101,8 @@ function islandora_basic_image_node_postinsert($node) {
return; return;
} }
$parent_collection = $node->parent_collection;
$nodes = entity_uuid_load('node', array($node->uuid)); $nodes = entity_uuid_load('node', array($node->uuid));
// Exit early if the node never was successfully inserted in the database. // Exit early if the node never was successfully inserted in the database.
@ -114,21 +116,24 @@ function islandora_basic_image_node_postinsert($node) {
$options = array( $options = array(
'method' => 'POST', 'method' => 'POST',
'data' => array( 'data' => array(
'files' => array( 'node' => json_encode($node),
'node' => array(json_encode($node)),
),
), ),
); );
// Add the obj file to the options if it exists. // Add the obj file to the options if it exists.
$has_obj = isset($_FILES['files']['tmp_name']['obj']); $has_obj = isset($_FILES['files']['tmp_name']['obj']);
if ($has_obj) { if ($has_obj) {
$options['data']['files']['obj'] = array($_FILES['files']['tmp_name']['obj']); $options['data']['files'] = array(
'obj' => array(
$_FILES['files']['tmp_name']['obj'],
),
);
} }
httprl_request("http://10.0.2.15:8888/islandora/rest/basic-image/?uuid={$node->uuid}", httprl_request("http://10.0.2.15:8888/islandora/rest/basic-image/?uuid=$parent_collection",
$options); $options);
$response = httprl_send_request(); $response = httprl_send_request();
dd($response);
} }
function islandora_basic_image_node_postupdate($node) { function islandora_basic_image_node_postupdate($node) {
@ -167,7 +172,7 @@ function islandora_basic_image_node_postupdate($node) {
dd($options); dd($options);
httprl_request("http://10.0.2.15:8888/islandora/rest/basic-image?uuid={$node->uuid}", httprl_request("http://10.0.2.15:8888/islandora/rest/basic-image/?uuid={$node->uuid}",
$options); $options);
$response = httprl_send_request(); $response = httprl_send_request();
} }

Loading…
Cancel
Save