Révision 13c3c9b4
Ajouté par Assos Assos il y a environ 9 ans
drupal7/sites/all/modules/advanced_forum/plugins/tasks/forum.inc | ||
---|---|---|
1 | 1 |
<?php |
2 |
/** |
|
3 |
* @file |
|
4 |
* Plugin for tasks. |
|
5 |
*/ |
|
2 | 6 |
|
7 |
/** |
|
8 |
* Page manager tasks. |
|
9 |
*/ |
|
3 | 10 |
function advanced_forum_forum_page_manager_tasks() { |
4 | 11 |
return array( |
5 |
// This is a 'page' task and will fall under the page admin UI |
|
12 |
// This is a 'page' task and will fall under the page admin UI.
|
|
6 | 13 |
'task type' => 'page', |
7 | 14 |
'title' => t('Forum page'), |
8 | 15 |
'admin title' => t('Forum page'), |
... | ... | |
12 | 19 |
'hook menu alter' => 'advanced_forum_forum_menu_alter', |
13 | 20 |
// This is task uses 'context' handlers and must implement these to give the |
14 | 21 |
// handler data it needs. |
15 |
'handler type' => 'context', // handler type -- misnamed |
|
22 |
// Handler type -- misnamed. |
|
23 |
'handler type' => 'context', |
|
16 | 24 |
'get arguments' => 'advanced_forum_forum_get_arguments', |
17 | 25 |
'get context placeholders' => 'advanced_forum_forum_get_contexts', |
18 | 26 |
// Allow this to be enabled or disabled: |
19 | 27 |
'disabled' => variable_get('advanced_forum_forum_disabled', TRUE), |
20 | 28 |
'enable callback' => 'advanced_forum_forum_enable', |
21 | 29 |
'access callback' => 'advanced_forum_forum_access_check', |
22 |
// Allow additional operations |
|
30 |
// Allow additional operations.
|
|
23 | 31 |
'operations' => array( |
24 | 32 |
'settings' => array( |
25 | 33 |
'title' => t('Settings'), |
... | ... | |
42 | 50 |
if (variable_get('advanced_forum_forum_disabled')) { |
43 | 51 |
return; |
44 | 52 |
} |
45 |
|
|
53 |
|
|
46 | 54 |
$items['forum']['page callback'] = 'advanced_forum_forum_page'; |
47 | 55 |
$items['forum']['file path'] = $task['path']; |
48 | 56 |
$items['forum']['file'] = $task['file']; |
49 | 57 |
|
50 |
// Take over forum/%advanced_forum_forum page |
|
58 |
// Take over forum/%advanced_forum_forum page.
|
|
51 | 59 |
$items['forum/%advanced_forum_forum']['page callback'] = 'advanced_forum_forum_page'; |
52 | 60 |
$items['forum/%advanced_forum_forum']['file path'] = $task['path']; |
53 | 61 |
$items['forum/%advanced_forum_forum']['file'] = $task['file']; |
54 |
|
|
55 | 62 |
} |
56 | 63 |
|
57 | 64 |
/** |
... | ... | |
66 | 73 |
$forum_term = advanced_forum_forum_load(0); |
67 | 74 |
} |
68 | 75 |
|
69 |
// Set tid for <root> container |
|
76 |
// Set tid for <root> container.
|
|
70 | 77 |
if (!isset($forum_term->tid)) { |
71 | 78 |
$forum_term->tid = 0; |
72 | 79 |
} |
... | ... | |
116 | 123 |
* Callback to enable/disable the page from the UI. |
117 | 124 |
*/ |
118 | 125 |
function advanced_forum_forum_enable($cache, $status) { |
119 |
if ($status == NULL) |
|
126 |
if ($status == NULL) {
|
|
120 | 127 |
$status = FALSE; |
128 |
} |
|
121 | 129 |
variable_set('advanced_forum_forum_disabled', $status); |
122 | 130 |
} |
123 | 131 |
|
... | ... | |
160 | 168 |
} |
161 | 169 |
} |
162 | 170 |
|
171 |
/** |
|
172 |
* Access check. |
|
173 |
*/ |
|
163 | 174 |
function advanced_forum_forum_access_check($task, $subtask_id, $contexts) { |
164 | 175 |
$context = reset($contexts); |
165 | 176 |
return node_access('view', $context->data); |
Formats disponibles : Unified diff
Weekly update of contrib modules