Projet

Général

Profil

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

root / drupal7 / sites / all / modules / advanced_forum / plugins / content_types / forum_node_create_list.inc @ 13c3c9b4

1
<?php
2
/**
3
 * @file
4
 * Forum node create list.
5
 */
6

    
7
/**
8
 * Callback function to supply a list of content types.
9
 */
10
function advanced_forum_forum_node_create_list_ctools_content_types() {
11
  return array(
12
    'single' => TRUE,
13
    'title' => t('Forum node create list'),
14
    'icon' => 'icon_forum.png',
15
    'description' => t('List of links to create new forum content nodes.'),
16
    'required context' => new ctools_context_required(t('Forum'), 'forum'),
17
    'category' => t('Forum'),
18
    'defaults' => array(),
19
  );
20
}
21

    
22
/**
23
 * Render the content.
24
 */
25
function advanced_forum_forum_node_create_list_content_type_render(
26
  $subtype,
27
  $conf,
28
  $panel_args,
29
  $context
30
) {
31
  if (!empty($context) && empty($context->data)) {
32
    return;
33
  }
34

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

    
40
  $block = new stdClass();
41
  $block->module = 'forum-node-create-list';
42
  $block->delta = $tid;
43

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

    
48
  $block->content = '<div class="forum-node-create-links">' . theme(
49
      'advanced_forum_node_type_create_list',
50
      array('forum_id' => $tid)
51
    ) . '</div>';
52

    
53
  return $block;
54
}
55

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

    
66
/**
67
 * Submit callback.
68
 */
69
function advanced_forum_forum_node_create_list_content_type_edit_form_submit(
70
  $form,
71
  &$form_state
72
) {
73
  // Copy everything from our defaults.
74
  foreach (array_keys($form_state['plugin']['defaults']) as $key) {
75
    $form_state['conf'][$key] = $form_state['values'][$key];
76
  }
77
}
78

    
79
/**
80
 * Callback for admin title.
81
 */
82
function advanced_forum_forum_node_create_list_content_type_admin_title(
83
  $subtype,
84
  $conf,
85
  $context
86
) {
87
  return t('"@s" forum node create list', array('@s' => $context->identifier));
88
}