-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathwebform_share.api.php
55 lines (49 loc) · 1.51 KB
/
webform_share.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
49
50
51
52
53
54
55
<?php
/**
* @file
* Sample hooks demonstrating usage in Webform Share.
*/
/**
* @defgroup webform_share_hooks Webform Share Module Hooks
* @{
* Webform Share's hooks enable other modules to intercept events within
* the module.
*/
/**
* Alter the webform data prior to importing.
*
* @param array $webform
* The webform data structure.
* @param array $context
* An array giving the context.
* Keys:
* - 'operation' - The operation being performed:
* - 'insert' - inserting a new node.
* - 'update' - adding a webform to an existing node.
* - 'node' - A reference to the node.
* - 'options' - Options selected by the user during the import.
* - 'components_only' - boolean indicating whether to erase (FALSE)
* or keep (TRUE) existing webform settings.
* - 'keep_existing_components' - boolean indicating if existing
* components should be preserved.
*/
function hook_webform_share_import_alter(&$webform, $context) {
$webform['my_setting'] = array(
'setting1' => 'value1',
'nid' => $context['node']->nid,
);
$context['node']->my_node_settings = array();
}
/**
* Alter the node data prior to exporting webform data.
*
* @param array $node
* The node to be exported. Any changes to the webform element will be
* reflected in the generated export file.
*/
function hook_webform_share_export_alter($node) {
$node->webform['my_setting'] = array();
}
/**
* @} webform_share_hooks
*/