diff --git a/modules/comment/comment.tokens.inc b/modules/comment/comment.tokens.inc index d62b7e2..c495ec3 100644 --- a/modules/comment/comment.tokens.inc +++ b/modules/comment/comment.tokens.inc @@ -155,9 +155,11 @@ function comment_tokens($type, $tokens, array $data = array(), array $options = break; case 'body': - $item = $comment->comment_body[LANGUAGE_NONE][0]; - $instance = field_info_instance('comment', 'body', 'comment_body'); - $replacements[$original] = $sanitize ? _text_sanitize($instance, LANGUAGE_NONE, $item, 'value') : $item['value']; + if ($items = field_get_items('comment', $comment, 'comment_body', $language_code)) { + $instance = field_info_instance('comment', 'body', 'comment_body'); + $field_langcode = field_language('comment', $comment, 'comment_body', $language_code); + $replacements[$original] = $sanitize ? _text_sanitize($instance, $field_langcode, $items[0], 'value') : $items[0]['value']; + } break; // Comment related URLs. diff --git a/modules/node/node.tokens.inc b/modules/node/node.tokens.inc index b6bafc6..491ec81 100644 --- a/modules/node/node.tokens.inc +++ b/modules/node/node.tokens.inc @@ -135,11 +135,11 @@ function node_tokens($type, $tokens, array $data = array(), array $options = arr case 'body': case 'summary': - if (!empty($node->body)) { - $item = $node->body[$node->language][0]; + if ($items = field_get_items('node', $node, 'body', $language_code)) { $column = ($name == 'body') ? 'value' : 'summary'; $instance = field_info_instance('node', 'body', $node->type); - $replacements[$original] = $sanitize ? _text_sanitize($instance, $node->language, $item, $column) : $item[$column]; + $field_langcode = field_language('node', $node, 'body', $language_code); + $replacements[$original] = $sanitize ? _text_sanitize($instance, $field_langcode, $items[0], $column) : $items[0][$column]; } break;