-
Notifications
You must be signed in to change notification settings - Fork 0
/
processclone.api.php
48 lines (45 loc) · 1.37 KB
/
processclone.api.php
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
<?php
/**
* @file
* API documentation for the Process Clone module.
*/
/**
* Alter the node before saving a duplicated node.
*
* @param $node
* Reference to the fully loaded node object being saved that
* can be altered as needed.
* @param array $context
* An array of context describing the process clone operation. The keys are:
* - 'method' : Can be either 'prepopulate' or 'save-edit'.
* - 'original_node' : The original fully loaded node object being cloned.
*
* @see processclone_node_save()
* @see drupal_alter()
*/
function hook_processclone_node_alter(&$node, $context) {
if ($context['original_node']->type == 'special') {
$node->special = special_something();
drupal_set_message("<pre>".print_r($node, TRUE)."</pre>");
}
}
/**
* Alter the access to the ability to clone a given node.
*
* @param bool $access
* Reference to the boolean determining if cloning should be allowed on a
* given node.
* @param $node
* The fully loaded node object being considered for cloning.
*
* @see processclone_access_cloning()
* @see drupal_alter()
*/
function hook_processclone_access_alter(&$access, $node) {
global $user;
// Only allow cloning of nodes posted to groups you belong to.
// This function doesn't really exist, but you get the idea...
if (!og_user_is_member_of_group_the_node_is_in($user, $node)) {
$access = FALSE;
}
}