Révision 13c3c9b4
Ajouté par Assos Assos il y a environ 9 ans
drupal7/sites/all/modules/advanced_forum/plugins/content_types/forum_list.inc | ||
---|---|---|
1 | 1 |
<?php |
2 |
/** |
|
3 |
* @file |
|
4 |
* Forum list. |
|
5 |
*/ |
|
2 | 6 |
|
3 | 7 |
/** |
4 | 8 |
* Plugins are described by creating a $plugin array which will be used |
... | ... | |
17 | 21 |
/** |
18 | 22 |
* Render the content. |
19 | 23 |
*/ |
20 |
function advanced_forum_forum_list_content_type_render($subtype, $conf, $panel_args, $context) { |
|
24 |
function advanced_forum_forum_list_content_type_render( |
|
25 |
$subtype, |
|
26 |
$conf, |
|
27 |
$panel_args, |
|
28 |
$context |
|
29 |
) { |
|
21 | 30 |
if (!empty($context) && empty($context->data)) { |
22 | 31 |
return; |
23 | 32 |
} |
24 | 33 |
|
25 |
if (empty($context)) { |
|
26 |
$tid = 0; |
|
27 |
} |
|
28 |
else { |
|
34 |
$tid = 0; |
|
35 |
if (!empty($context)) { |
|
29 | 36 |
$tid = $context->data->tid; |
30 | 37 |
} |
31 | 38 |
|
... | ... | |
38 | 45 |
$forum_term = advanced_forum_forum_load($tid); |
39 | 46 |
$forums = isset($forum_term->forums) ? $forum_term->forums : array(); |
40 | 47 |
|
41 |
if (!empty($forums)) { |
|
42 |
// No parents on the main forum page. |
|
43 |
$block->content = theme('forum_list', array( |
|
48 |
if (empty($forums)) { |
|
49 |
return $block; |
|
50 |
} |
|
51 |
// No parents on the main forum page. |
|
52 |
$block->content = theme( |
|
53 |
'forum_list', |
|
54 |
array( |
|
44 | 55 |
'forums' => $forums, |
45 | 56 |
'parents' => empty($context->parents) ? array() : $context->parents, |
46 |
'tid' => $tid |
|
47 |
)); |
|
57 |
'tid' => $tid, |
|
58 |
) |
|
59 |
); |
|
48 | 60 |
|
61 |
if (user_access('administer forums')) { |
|
62 |
$block->admin_links['administer_forums'] = array( |
|
63 |
'title' => t('Administer forums'), |
|
64 |
'alt' => t("Add, delete or modify forums"), |
|
65 |
'href' => "admin/structure/forum", |
|
66 |
); |
|
49 | 67 |
|
50 |
if (user_access('administer forums')) { |
|
51 |
$block->admin_links['administer_forums'] = array( |
|
52 |
'title' => t('Administer forums'), |
|
53 |
'alt' => t("Add, delete or modify forums"), |
|
54 |
'href' => "admin/structure/forum", |
|
68 |
if ($tid) { |
|
69 |
$block->admin_links['edit_forum'] = array( |
|
70 |
'title' => t('Edit forum'), |
|
71 |
'alt' => t("Modify this forum"), |
|
72 |
'href' => "admin/structure/forum/edit/" . ($context->data->container ? 'container/' : 'forum/') . $tid, |
|
73 |
'query' => drupal_get_destination(), |
|
55 | 74 |
); |
56 |
|
|
57 |
if ($tid) { |
|
58 |
$block->admin_links['edit_forum'] = array( |
|
59 |
'title' => t('Edit forum'), |
|
60 |
'alt' => t("Modify this forum"), |
|
61 |
'href' => "admin/structure/forum/edit/" . ($context->data->container ? 'container/' : 'forum/') . $tid, |
|
62 |
'query' => drupal_get_destination(), |
|
63 |
); |
|
64 |
} |
|
65 | 75 |
} |
66 | 76 |
} |
77 |
|
|
67 | 78 |
return $block; |
68 | 79 |
} |
69 | 80 |
|
... | ... | |
74 | 85 |
return $form; |
75 | 86 |
} |
76 | 87 |
|
77 |
function advanced_forum_forum_list_content_type_edit_form_submit($form, &$form_state) { |
|
88 |
/** |
|
89 |
* Submit callback. |
|
90 |
*/ |
|
91 |
function advanced_forum_forum_list_content_type_edit_form_submit( |
|
92 |
$form, |
|
93 |
&$form_state |
|
94 |
) { |
|
78 | 95 |
// Copy everything from our defaults. |
79 | 96 |
foreach (array_keys($form_state['plugin']['defaults']) as $key) { |
80 | 97 |
$form_state['conf'][$key] = $form_state['values'][$key]; |
81 | 98 |
} |
82 | 99 |
} |
83 | 100 |
|
84 |
function advanced_forum_forum_list_content_type_admin_title($subtype, $conf, $context) { |
|
101 |
/** |
|
102 |
* Callback for admin title. |
|
103 |
*/ |
|
104 |
function advanced_forum_forum_list_content_type_admin_title( |
|
105 |
$subtype, |
|
106 |
$conf, |
|
107 |
$context |
|
108 |
) { |
|
85 | 109 |
return t('"@s" forum list', array('@s' => $context->identifier)); |
86 | 110 |
} |
Formats disponibles : Unified diff
Weekly update of contrib modules