forked from rosiel/islandora_relationship_editor
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathDelete.inc
58 lines (49 loc) · 1.41 KB
/
Delete.inc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<?php
function islandora_relationship_editor_delete_relationships(array $form, array &$form_state, $objectPid, $namespace, $relationship, $targetPid) {
$subject = islandora_object_load($objectPid);
if (!$subject) {
drupal_set_message("Fedora object " . $objectPid . " not found.");
drupal_not_found();
exit;
}
if ($subject->relationships->remove(urldecode($namespace), $relationship, $targetPid)) {
return array(
'object_pid' => array(
'#type' => 'hidden',
'#value' => $objectPid,
),
'description' => array(
'#type' => 'markup',
'#prefix' => '<div>',
'#markup' => t('Relationship deleted'),
'#suffix' => '</div>',
),
'back' => array(
'#type' => 'submit',
'#value' => t('Go back'),
'#name' => 'back',
),
);
} else {
return array(
'object_pid' => array(
'#type' => 'hidden',
'#value' => $objectPid,
),
'description' => array(
'#type' => 'markup',
'#prefix' => '<div>',
'#markup' => t('Relationship delete ERROR'),
'#suffix' => '</div>',
),
'back' => array(
'#type' => 'submit',
'#value' => t('Go back'),
'#name' => 'back',
),
);
}
}
function islandora_relationship_editor_delete_relationships_submit(array $form, array &$form_state) {
$form_state['redirect'] = 'islandora/object/' . $form_state['values']['object_pid'] . '/manage/relationships';
}