Projet

Général

Profil

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

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

1 85ad3d82 Assos Assos
<?php
2 13c3c9b4 Assos Assos
/**
3
 * @file
4
 * Forum topic search.
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 search'),
14
  'icon' => 'icon_forum.png',
15
  'description' => t('The forum search widget.'),
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_search_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-secondary-links';
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 13c3c9b4 Assos Assos
  $block->content = '<div id="search-all-forums">' . theme(
48
      'advanced_forum_search_forum'
49
    ) . '</div>';
50 85ad3d82 Assos Assos
51
  return $block;
52
}
53
54
/**
55
 * Returns an edit form for the custom type.
56
 */
57 13c3c9b4 Assos Assos
function advanced_forum_forum_search_content_type_edit_form(
58
  $form,
59
  &$form_state
60
) {
61 85ad3d82 Assos Assos
  return $form;
62
}
63
64 13c3c9b4 Assos Assos
/**
65
 * Submit callback.
66
 */
67
function advanced_forum_forum_search_content_type_edit_form_submit(
68
  $form,
69
  &$form_state
70
) {
71 85ad3d82 Assos Assos
  // Copy everything from our defaults.
72
  foreach (array_keys($form_state['plugin']['defaults']) as $key) {
73
    $form_state['conf'][$key] = $form_state['values'][$key];
74
  }
75
}
76
77 13c3c9b4 Assos Assos
/**
78
 * Callback for admin title.
79
 */
80
function advanced_forum_forum_search_content_type_admin_title(
81
  $subtype,
82
  $conf,
83
  $context
84
) {
85 85ad3d82 Assos Assos
  return t('"@s" search', array('@s' => $context->identifier));
86
}