summaryrefslogtreecommitdiff
path: root/modules/comment/comment.module
diff options
context:
space:
mode:
authorDavid Rothstein <drothstein@gmail.com>2012-12-26 22:49:51 -0500
committerDavid Rothstein <drothstein@gmail.com>2012-12-26 22:49:51 -0500
commitdfed194c6393a496bceb69b83081a86c0196297a (patch)
treecb6be993d05dfb27d4c396b715e13ec73e4f1bf3 /modules/comment/comment.module
parent9edacf1adce95d8aca42180ef5b90f86c0dbfaa1 (diff)
downloadbrdo-dfed194c6393a496bceb69b83081a86c0196297a.tar.gz
brdo-dfed194c6393a496bceb69b83081a86c0196297a.tar.bz2
Issue #1534674 by plach, slowflyer: Fixed Comment field language is completely broken.
Diffstat (limited to 'modules/comment/comment.module')
-rw-r--r--modules/comment/comment.module10
1 files changed, 7 insertions, 3 deletions
diff --git a/modules/comment/comment.module b/modules/comment/comment.module
index 4241538a0..8b51f7662 100644
--- a/modules/comment/comment.module
+++ b/modules/comment/comment.module
@@ -2041,7 +2041,8 @@ function comment_form($form, &$form_state, $comment) {
// Attach fields.
$comment->node_type = 'comment_node_' . $node->type;
- field_attach_form('comment', $comment, $form, $form_state);
+ $langcode = entity_language('comment', $comment);
+ field_attach_form('comment', $comment, $form, $form_state, $langcode);
return $form;
}
@@ -2066,7 +2067,8 @@ function comment_preview($comment) {
$node = node_load($comment->nid);
if (!form_get_errors()) {
- $comment->format = $comment->comment_body[LANGUAGE_NONE][0]['format'];
+ $comment_body = field_get_items('comment', $comment, 'comment_body');
+ $comment->format = $comment_body[0]['format'];
// Attach the user and time information.
if (!empty($comment->name)) {
$account = user_load_by_name($comment->name);
@@ -2190,7 +2192,9 @@ function comment_submit($comment) {
// 1) Filter it into HTML
// 2) Strip out all HTML tags
// 3) Convert entities back to plain-text.
- $comment_body = $comment->comment_body[LANGUAGE_NONE][0];
+ $field = field_info_field('comment_body');
+ $langcode = field_is_translatable('comment', $field) ? entity_language('comment', $comment) : LANGUAGE_NONE;
+ $comment_body = $comment->comment_body[$langcode][0];
if (isset($comment_body['format'])) {
$comment_text = check_markup($comment_body['value'], $comment_body['format']);
}