summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG.txt1
-rw-r--r--plugins/content_types/node_context/node_comment_form.inc23
2 files changed, 23 insertions, 1 deletions
diff --git a/CHANGELOG.txt b/CHANGELOG.txt
index 3b6742d..9f82d92 100644
--- a/CHANGELOG.txt
+++ b/CHANGELOG.txt
@@ -64,6 +64,7 @@ Restore a less aggressive plugin caching.
#861778 by ayalon: Hold session ID for anonymous users when using the object cache so wizards can work for anonymous.
#846408: Increase #delta in reorder weights so that more than 21 variants can be used.
#827310: Node comments content type should not display comments if the node is configured to disable them.
+#622570 by omerida: Add an option to display the comment forbidden information if the comment form cannot be displayed in comment form content type.
ctools 6.x-1.6 (2010-Jun-1)
==============
diff --git a/plugins/content_types/node_context/node_comment_form.inc b/plugins/content_types/node_context/node_comment_form.inc
index 200da35..4cd1588 100644
--- a/plugins/content_types/node_context/node_comment_form.inc
+++ b/plugins/content_types/node_context/node_comment_form.inc
@@ -13,6 +13,7 @@ if (module_exists('comment')) {
'description' => t('A form to add a new comment.'),
'required context' => new ctools_context_required(t('Node'), 'node'),
'category' => t('Node'),
+ 'defaults' => array('anon_links' => false),
);
}
@@ -37,6 +38,9 @@ function ctools_node_comment_form_content_type_render($subtype, $conf, $panel_ar
);
$block->content = ctools_build_form('comment_form', $form_state);
}
+ else if (!empty($conf['anon_links'])) {
+ $block->content = theme('comment_post_forbidden', $node);
+ }
}
return $block;
@@ -47,7 +51,24 @@ function ctools_node_comment_form_content_type_admin_title($subtype, $conf, $con
}
function ctools_node_comment_form_content_type_edit_form(&$form, &$form_state) {
- // provide a blank form so we have a place to have context setting.
+ $form['anon_links'] = array(
+ '#type' => 'checkbox',
+ '#title' => t('Shows links to register or login.'),
+ '#description' => t('If anonymous comments are not allowed, this will display the register and login links.'),
+ '#default_value' => $form_state['conf']['anon_links'],
+ );
+}
+
+function ctools_node_comment_form_content_type_edit_form_submit(&$form, &$form_state) {
+ // For each part of the form defined in the 'defaults' array set when you
+ // defined the content type, copy the value from the form into the array
+ // of items to be saved. We don't ever want to use
+ // $form_state['conf'] = $form_state['values'] because values contains
+ // buttons, form id and other items we don't want stored. CTools will handle
+ // the actual form submission.
+ foreach (array_keys($form_state['plugin']['defaults']) as $key) {
+ $form_state['conf'][$key] = $form_state['values'][$key];
+ }
}
/**