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 @ 13c3c9b4

1
<?php
2
/**
3
 * @file
4
 * Forum topic search.
5
 */
6

    
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
function advanced_forum_forum_search_content_type_render(
25
  $subtype,
26
  $conf,
27
  $panel_args,
28
  $context
29
) {
30
  if (!empty($context) && empty($context->data)) {
31
    return;
32
  }
33

    
34
  $tid = 0;
35
  if (!empty($context)) {
36
    $tid = $context->data->tid;
37
  }
38

    
39
  $block = new stdClass();
40
  $block->module = 'forum-secondary-links';
41
  $block->delta = $tid;
42

    
43
  // By default this has no title.
44
  $block->title = '';
45
  _advanced_forum_add_files();
46

    
47
  $block->content = '<div id="search-all-forums">' . theme(
48
      'advanced_forum_search_forum'
49
    ) . '</div>';
50

    
51
  return $block;
52
}
53

    
54
/**
55
 * Returns an edit form for the custom type.
56
 */
57
function advanced_forum_forum_search_content_type_edit_form(
58
  $form,
59
  &$form_state
60
) {
61
  return $form;
62
}
63

    
64
/**
65
 * Submit callback.
66
 */
67
function advanced_forum_forum_search_content_type_edit_form_submit(
68
  $form,
69
  &$form_state
70
) {
71
  // 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
/**
78
 * Callback for admin title.
79
 */
80
function advanced_forum_forum_search_content_type_admin_title(
81
  $subtype,
82
  $conf,
83
  $context
84
) {
85
  return t('"@s" search', array('@s' => $context->identifier));
86
}