1 |
85ad3d82
|
Assos Assos
|
<?php
|
2 |
13c3c9b4
|
Assos Assos
|
/**
|
3 |
|
|
* @file
|
4 |
|
|
* Forum topic sort.
|
5 |
|
|
*/
|
6 |
85ad3d82
|
Assos Assos
|
|
7 |
|
|
/**
|
8 |
|
|
* Plugins are described by creating a $plugin array which will be used
|
9 |
|
|
* by the system that includes this file.
|
10 |
|
|
*/
|
11 |
|
|
$plugin = array(
|
12 |
|
|
'single' => TRUE,
|
13 |
|
|
'title' => t('Forum topic list sort widget'),
|
14 |
|
|
'icon' => 'icon_forum.png',
|
15 |
13c3c9b4
|
Assos Assos
|
'description' => t(
|
16 |
|
|
'A small select widget to change the sort order of the forum topic list'
|
17 |
|
|
),
|
18 |
85ad3d82
|
Assos Assos
|
'required context' => new ctools_context_required(t('Forum'), 'forum'),
|
19 |
|
|
'category' => t('Forum'),
|
20 |
|
|
'defaults' => array(),
|
21 |
|
|
);
|
22 |
|
|
|
23 |
|
|
/**
|
24 |
|
|
* Render the content.
|
25 |
|
|
*/
|
26 |
13c3c9b4
|
Assos Assos
|
function advanced_forum_forum_topic_list_sort_content_type_render(
|
27 |
|
|
$subtype,
|
28 |
|
|
$conf,
|
29 |
|
|
$panel_args,
|
30 |
|
|
$context
|
31 |
|
|
) {
|
32 |
85ad3d82
|
Assos Assos
|
if (!empty($context) && empty($context->data)) {
|
33 |
|
|
return;
|
34 |
|
|
}
|
35 |
|
|
|
36 |
13c3c9b4
|
Assos Assos
|
$tid = 0;
|
37 |
|
|
if (!empty($context)) {
|
38 |
85ad3d82
|
Assos Assos
|
$tid = $context->data->tid;
|
39 |
|
|
}
|
40 |
|
|
|
41 |
|
|
if (empty($tid)) {
|
42 |
|
|
return;
|
43 |
|
|
}
|
44 |
|
|
|
45 |
|
|
$block = new stdClass();
|
46 |
|
|
$block->module = 'forum-secondary-links';
|
47 |
|
|
$block->delta = $tid;
|
48 |
|
|
|
49 |
13c3c9b4
|
Assos Assos
|
// By default this has no title.
|
50 |
|
|
$block->title = '';
|
51 |
85ad3d82
|
Assos Assos
|
_advanced_forum_add_files();
|
52 |
|
|
|
53 |
|
|
$block->content = advanced_forum_forum_topic_list_sort();
|
54 |
|
|
|
55 |
|
|
return $block;
|
56 |
|
|
}
|
57 |
|
|
|
58 |
|
|
/**
|
59 |
|
|
* Returns an edit form for the custom type.
|
60 |
|
|
*/
|
61 |
13c3c9b4
|
Assos Assos
|
function advanced_forum_forum_topic_list_sort_content_type_edit_form(
|
62 |
|
|
$form,
|
63 |
|
|
&$form_state
|
64 |
|
|
) {
|
65 |
85ad3d82
|
Assos Assos
|
return $form;
|
66 |
|
|
}
|
67 |
|
|
|
68 |
13c3c9b4
|
Assos Assos
|
/**
|
69 |
|
|
* Submit callback.
|
70 |
|
|
*/
|
71 |
|
|
function advanced_forum_forum_topic_list_sort_content_type_edit_form_submit(
|
72 |
|
|
$form,
|
73 |
|
|
&$form_state
|
74 |
|
|
) {
|
75 |
85ad3d82
|
Assos Assos
|
// Copy everything from our defaults.
|
76 |
|
|
foreach (array_keys($form_state['plugin']['defaults']) as $key) {
|
77 |
|
|
$form_state['conf'][$key] = $form_state['values'][$key];
|
78 |
|
|
}
|
79 |
|
|
}
|
80 |
|
|
|
81 |
13c3c9b4
|
Assos Assos
|
/**
|
82 |
|
|
* Callback for admin title.
|
83 |
|
|
*/
|
84 |
|
|
function advanced_forum_forum_topic_list_sort_content_type_admin_title(
|
85 |
|
|
$subtype,
|
86 |
|
|
$conf,
|
87 |
|
|
$context
|
88 |
|
|
) {
|
89 |
85ad3d82
|
Assos Assos
|
return t('"@s" topic list sort widget', array('@s' => $context->identifier));
|
90 |
|
|
} |