1
|
<?php
|
2
|
|
3
|
/**
|
4
|
* Plugins are described by creating a $plugin array which will be used
|
5
|
* by the system that includes this file.
|
6
|
*/
|
7
|
$plugin = array(
|
8
|
'single' => TRUE,
|
9
|
'title' => t('Forum mark read'),
|
10
|
'icon' => 'icon_forum.png',
|
11
|
'description' => t('Link to mark all forums / individual forum read.'),
|
12
|
'required context' => new ctools_context_required(t('Forum'), 'forum'),
|
13
|
'category' => t('Forum'),
|
14
|
'defaults' => array(),
|
15
|
);
|
16
|
|
17
|
/**
|
18
|
* Render the content.
|
19
|
*/
|
20
|
function advanced_forum_forum_mark_read_content_type_render($subtype, $conf, $panel_args, $context) {
|
21
|
if (!empty($context) && empty($context->data)) {
|
22
|
return;
|
23
|
}
|
24
|
|
25
|
if (empty($context)) {
|
26
|
$tid = 0;
|
27
|
}
|
28
|
else {
|
29
|
$tid = $context->data->tid;
|
30
|
}
|
31
|
|
32
|
$block = new stdClass();
|
33
|
$block->module = 'forum-mark-read';
|
34
|
$block->delta = $tid;
|
35
|
|
36
|
$block->title = ''; // by default this has no title.
|
37
|
_advanced_forum_add_files();
|
38
|
|
39
|
$mar_link = advanced_forum_get_mark_read_link($tid);
|
40
|
$block->content = (empty($mar_link)) ? '' : '<div class="forum-mark-read">' . advanced_forum_get_mark_read_link($tid) . '</div>';
|
41
|
|
42
|
return $block;
|
43
|
}
|
44
|
|
45
|
/**
|
46
|
* Returns an edit form for the custom type.
|
47
|
*/
|
48
|
function advanced_forum_forum_mark_read_content_type_edit_form($form, &$form_state) {
|
49
|
return $form;
|
50
|
}
|
51
|
|
52
|
function advanced_forum_forum_mark_read_content_type_edit_form_submit($form, &$form_state) {
|
53
|
// Copy everything from our defaults.
|
54
|
foreach (array_keys($form_state['plugin']['defaults']) as $key) {
|
55
|
$form_state['conf'][$key] = $form_state['values'][$key];
|
56
|
}
|
57
|
}
|
58
|
|
59
|
function advanced_forum_forum_mark_read_content_type_admin_title($subtype, $conf, $context) {
|
60
|
return t('"@s" mark read', array('@s' => $context->identifier));
|
61
|
}
|