-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathoa_discussion.install
57 lines (52 loc) · 1.55 KB
/
oa_discussion.install
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
<?php
/**
* @file
* oa_discussion.install
*/
/**
* Implements hook_install().
*/
function oa_discussion_install() {
oa_discussion_install_section_type();
}
/**
* Create the Discussion Section taxonomy term.
*/
function oa_discussion_install_section_type() {
$params = array(
'description' => 'Allows users to create <em>Discussion posts</em> and displays a list of topics.',
'node_options' => array(
'oa_discussion_post',
),
'layout' => 'node:oa_section:oa_section_discussion',
'icon' => 'icon-comments',
);
oa_core_create_term('section_type', 'Discussion Section', $params);
}
/**
* Update the Discussion section term.
*/
function oa_discussion_update_7002() {
oa_discussion_install_section_type();
}
/**
* Update discussion widgets for new pane settings.
*/
function oa_discussion_update_7103() {
$result = db_query("SELECT pid, configuration FROM {panels_pane} where subtype = 'open_atrium_discussions-discussion_topics' and configuration not like '%og_group_ref_target_id%'");
foreach ($result as $row) {
$config = unserialize($row->configuration);
$config['exposed']['og_group_ref_target_id'] = '';
$config['exposed']['og_group_ref_target_id_mine'] = 0;
$config['exposed']['og_subspaces_view_all'] = 1;
$config['exposed']['og_subspaces_view_parent'] = 0;
$config['exposed']['oa_section_ref_target_id'] = '';
$config = serialize($config);
db_update('panels_pane')
->fields(array(
'configuration' => $config,
))
->condition('pid', $row->pid)
->execute();
}
}