This repository has been archived by the owner on Mar 3, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 27
/
commons.api.php
79 lines (74 loc) · 2.26 KB
/
commons.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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
<?php
/**
* @file
* Hooks provided by the Commons module.
*/
/**
* @addtogroup hooks
* @{
*/
/**
* Define entity integrations.
*
* This hook allows modules to register entity types and/or bundles that they
* provide for integration with Commons functionality. For example, a webform
* module could use it to register a form entity type and its "Test", "Survey"
* and "Suggestion" bundles.
*
* @return
* An associative array of entity integrations whose keys define the entity
* type for each integration and whose values contain the bundles which have
* been integrated. Each bundle is itself an associative array, whose keys
* define the type of integration to enable and whose values contain the
* status of the integration. TRUE = enabled, FALSE = disabled.
*
* For a detailed usage example, see commons_q_a.module.
*
* @see hook_commons_entity_integration_alter()
*/
function hook_commons_entity_integration() {
// Register three of the webform entity's bundles for various integrations.
return array(
'webform' => array(
'test' => array(
'exclude_rate' => TRUE,
'is_group_content' => FALSE,
),
'survey' => array(
'is_group_content' => TRUE,
'exclude_topics' => TRUE,
),
'suggestion' => array(
'media' => TRUE,
'is_group_content' => TRUE,
'exclude_commons_follow' => TRUE,
),
),
'node' => array(
'group' => array(
'is_group_content' => FALSE,
'is_group' => TRUE,
'exclude_commons_follow' => TRUE,
),
),
);
}
/**
* Perform alterations on entity integrations.
*
* @param $integrations
* An associative array of entity integrations whose keys define the entity
* type for each integration and whose values contain the bundles which have
* been integrated. Each bundle is itself an associative array, whose keys
* define the type of integration to enable and whose values contain the
* status of the integration. TRUE = enabled, FALSE = disabled.
*
* @see hook_commons_entity_integration()
*/
function hook_commons_entity_integration_alter(&$integrations) {
// Disable Media integration for the post content type.
$integrations['node']['post']['media'] = FALSE;
}
/**
* @} End of "addtogroup hooks".
*/