1 |
85ad3d82
|
Assos Assos
|
<?php
|
2 |
|
|
|
3 |
|
|
/**
|
4 |
|
|
* @file
|
5 |
|
|
* Ctools content-type plugin to provide a comment-reply form (replying either
|
6 |
|
|
* to a node or to another comment).
|
7 |
|
|
*/
|
8 |
|
|
|
9 |
|
|
// Only provide the plugin in the comment module is enabled.
|
10 |
|
|
if (module_exists('comment')) {
|
11 |
|
|
$plugin = array(
|
12 |
|
|
'single' => TRUE,
|
13 |
|
|
'title' => t('Comment Reply Form'),
|
14 |
|
|
'icon' => 'icon_comment.png',
|
15 |
|
|
'description' => t('A form to add a new comment reply.'),
|
16 |
|
|
'required context' => array(
|
17 |
|
|
new ctools_context_required(t('Node'), 'node'),
|
18 |
|
|
new ctools_context_optional(t('Comment'), 'comment'),
|
19 |
|
|
),
|
20 |
|
|
'category' => t('Comment'),
|
21 |
|
|
'render callback' => 'ctools_comment_reply_form_content_type_render',
|
22 |
|
|
'defaults' => array('anon_links' => false),
|
23 |
|
|
);
|
24 |
|
|
}
|
25 |
|
|
|
26 |
|
|
function ctools_comment_reply_form_content_type_render($subtype, $conf, $panel_args, $context) {
|
27 |
|
|
|
28 |
3753f249
|
Assos Assos
|
$comment = ($context[1]->identifier == t('No context')) ? NULL : clone($context[1]->data);
|
29 |
85ad3d82
|
Assos Assos
|
$block = new stdClass();
|
30 |
|
|
$block->module = 'comments';
|
31 |
|
|
if ($comment) $block->delta = $comment->cid;
|
32 |
|
|
$block->title = t('Add comment');
|
33 |
|
|
$node = $context[0]->data;
|
34 |
|
|
|
35 |
|
|
module_load_include('inc', 'comment', 'comment.pages');
|
36 |
|
|
$block->content = comment_reply($node, ($comment ? $comment->cid : NULL));
|
37 |
|
|
|
38 |
|
|
return $block;
|
39 |
|
|
}
|
40 |
|
|
|
41 |
|
|
function ctools_comment_reply_form_content_type_admin_title($subtype, $conf, $context) {
|
42 |
|
|
return t('"@s" comment form', array('@s' => $context[0]->identifier));
|
43 |
|
|
}
|
44 |
|
|
|
45 |
|
|
function ctools_comment_reply_form_content_type_edit_form($form, &$form_state) {
|
46 |
|
|
return $form;
|
47 |
|
|
}
|
48 |
|
|
|
49 |
|
|
function ctools_comment_reply_form_content_type_edit_form_submit($form, &$form_state) {
|
50 |
|
|
} |