Projet

Général

Profil

Paste
Télécharger (1,78 ko) Statistiques
| Branche: | Révision:

root / drupal7 / sites / all / modules / advanced_forum / plugins / content_types / forum_mark_read.inc @ 27370441

1 85ad3d82 Assos Assos
<?php
2 13c3c9b4 Assos Assos
/**
3
 * @file
4
 * Mark read.
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 mark read'),
14
  'icon' => 'icon_forum.png',
15
  'description' => t('Link to mark all forums / individual forum read.'),
16
  'required context' => new ctools_context_required(t('Forum'), 'forum'),
17
  'category' => t('Forum'),
18
  'defaults' => array(),
19
);
20
21
/**
22
 * Render the content.
23
 */
24 13c3c9b4 Assos Assos
function advanced_forum_forum_mark_read_content_type_render(
25
  $subtype,
26
  $conf,
27
  $panel_args,
28
  $context
29
) {
30 85ad3d82 Assos Assos
  if (!empty($context) && empty($context->data)) {
31
    return;
32
  }
33
34 13c3c9b4 Assos Assos
  $tid = 0;
35
  if (!empty($context)) {
36 85ad3d82 Assos Assos
    $tid = $context->data->tid;
37
  }
38
39
  $block = new stdClass();
40
  $block->module = 'forum-mark-read';
41
  $block->delta = $tid;
42
43 13c3c9b4 Assos Assos
  // By default this has no title.
44
  $block->title = '';
45 85ad3d82 Assos Assos
  _advanced_forum_add_files();
46
47
  $mar_link = advanced_forum_get_mark_read_link($tid);
48 13c3c9b4 Assos Assos
  $block->content = (empty($mar_link)) ? '' : '<div class="forum-mark-read">' . advanced_forum_get_mark_read_link(
49
      $tid
50
    ) . '</div>';
51 85ad3d82 Assos Assos
52
  return $block;
53
}
54
55
/**
56
 * Returns an edit form for the custom type.
57
 */
58 13c3c9b4 Assos Assos
function advanced_forum_forum_mark_read_content_type_edit_form(
59
  $form,
60
  &$form_state
61
) {
62 85ad3d82 Assos Assos
  return $form;
63
}
64
65 13c3c9b4 Assos Assos
/**
66
 * Submit callback.
67
 */
68
function advanced_forum_forum_mark_read_content_type_edit_form_submit(
69
  $form,
70
  &$form_state
71
) {
72 85ad3d82 Assos Assos
  // Copy everything from our defaults.
73
  foreach (array_keys($form_state['plugin']['defaults']) as $key) {
74
    $form_state['conf'][$key] = $form_state['values'][$key];
75
  }
76
}
77
78 13c3c9b4 Assos Assos
/**
79
 * Callback for admin title.
80
 */
81
function advanced_forum_forum_mark_read_content_type_admin_title(
82
  $subtype,
83
  $conf,
84
  $context
85
) {
86 85ad3d82 Assos Assos
  return t('"@s" mark read', array('@s' => $context->identifier));
87
}