[1mdiff --git a/modules/comment/comment.install b/modules/comment/comment.install[m [1mindex 0213808..a189729 100644[m [1m--- a/modules/comment/comment.install[m [1m+++ b/modules/comment/comment.install[m [36m@@ -17,15 +17,15 @@[m [mfunction comment_uninstall() {[m $node_types = array_keys(node_type_get_types());[m foreach ($node_types as $node_type) {[m field_attach_delete_bundle('comment', 'comment_node_' . $node_type);[m [31m- variable_del('comment_' . $node_type);[m [31m- variable_del('comment_anonymous_' . $node_type);[m [31m- variable_del('comment_controls_' . $node_type);[m [31m- variable_del('comment_default_mode_' . $node_type);[m [31m- variable_del('comment_default_order_' . $node_type);[m [31m- variable_del('comment_default_per_page_' . $node_type);[m [31m- variable_del('comment_form_location_' . $node_type);[m [31m- variable_del('comment_preview_' . $node_type);[m [31m- variable_del('comment_subject_field_' . $node_type);[m [32m+[m[32m variable_del('comment_node_' . $node_type);[m [32m+[m[32m variable_del('comment_anonymous_node_' . $node_type);[m [32m+[m[32m variable_del('comment_controls_node_' . $node_type);[m [32m+[m[32m variable_del('comment_default_mode_node_' . $node_type);[m [32m+[m[32m variable_del('comment_default_order_node_' . $node_type);[m [32m+[m[32m variable_del('comment_default_per_page_node_' . $node_type);[m [32m+[m[32m variable_del('comment_form_location_node_' . $node_type);[m [32m+[m[32m variable_del('comment_preview_node_' . $node_type);[m [32m+[m[32m variable_del('comment_subject_field_node_' . $node_type);[m }[m }[m [m [36m@@ -195,10 +195,17 @@[m [mfunction comment_schema() {[m ),[m );[m [m [31m- $schema['node_comment_statistics'] = array([m [32m+[m[32m $schema['comment_entity_statistics'] = array([m 'description' => 'Maintains statistics of node and comments posts to show "new" and "updated" flags.',[m 'fields' => array([m [31m- 'nid' => array([m [32m+[m[32m 'entity_type' => array([m [32m+[m[32m 'type' => 'varchar',[m [32m+[m[32m 'length' => 128,[m [32m+[m[32m 'not null' => TRUE,[m [32m+[m[32m 'default' => '',[m [32m+[m[32m 'description' => 'The entity type',[m [32m+[m[32m ),[m [32m+[m[32m 'entity_id' => array([m 'type' => 'int',[m 'unsigned' => TRUE,[m 'not null' => TRUE,[m [36m@@ -237,9 +244,10 @@[m [mfunction comment_schema() {[m 'description' => 'The total number of comments on this node.',[m ),[m ),[m [31m- 'primary key' => array('nid'),[m [32m+[m[32m 'primary key' => array('entity_id'),[m 'indexes' => array([m [31m- 'node_comment_timestamp' => array('last_comment_timestamp'),[m [32m+[m[32m 'entity_type' => array('entity_type'),[m [32m+[m[32m 'entity_comment_timestamp' => array('last_comment_timestamp'),[m 'comment_count' => array('comment_count'),[m 'last_comment_uid' => array('last_comment_uid'),[m ),[m [36m@@ -259,3 +267,53 @@[m [mfunction comment_schema() {[m [m return $schema;[m }[m [32m+[m [32m+[m[32m/**[m [32m+[m[32m * Rename comment/node variable to comment/entity.[m [32m+[m[32m */[m [32m+[m[32mfunction comment_update_8000() {[m [32m+[m[32m foreach (node_type_get_types() as $node_type) {[m [32m+[m[32m $old_keys[] = 'comment_';[m [32m+[m[32m $old_keys[] = 'comment_default_mode_';[m [32m+[m[32m $old_keys[] = 'comment_default_per_page_';[m [32m+[m[32m $old_keys[] = 'comment_anonymous_';[m [32m+[m[32m $old_keys[] = 'comment_subject_field_';[m [32m+[m[32m $old_keys[] = 'comment_form_location_';[m [32m+[m[32m $old_keys[] = 'comment_preview_';[m [32m+[m[32m foreach ($old_keys as $old_key) {[m [32m+[m[32m $new_key = "{$old_key}_node_{$node_type->type}";[m [32m+[m[32m $old_key = "{$old_key}_{$node_type->type}";[m [32m+[m[32m $variable = variable_get($old_key);[m [32m+[m[32m variable_set($new_key, $variable);[m [32m+[m[32m variable_del($old_key);[m [32m+[m[32m }[m [32m+[m[32m }[m [32m+[m[32m}[m [32m+[m [32m+[m[32m/**[m [32m+[m[32m * Update table {node_comment_statistics}.[m [32m+[m[32m */[m [32m+[m[32mfunction comment_update_8001() {[m [32m+[m[32m # Rename {node_comment_statistics} to {comment_entity_statistics}[m [32m+[m[32m db_rename_table('node_comment_statistics', 'comment_entity_statistics');[m [32m+[m [32m+[m[32m # Add field entity_type[m [32m+[m[32m $comment_schema = comment_schema();[m [32m+[m[32m $entity_column = $comment_schema['comment_entity_statistics']['fields']['entity_type'];[m [32m+[m[32m db_add_field('comment_entity_statistics', 'entity_type', $entity_column);[m [32m+[m [32m+[m[32m # Set entity_type to 'node'[m [32m+[m[32m db_update('comment_entity_statistics')[m [32m+[m[32m ->fields(array('entity_type' => 'node'))[m [32m+[m[32m ->execute();[m [32m+[m [32m+[m[32m # Rename nid to entity_id[m [32m+[m[32m $entity_id_column = $comment_schema['comment_entity_statistics']['fields']['entity_id'];[m [32m+[m[32m db_change_field('comment_entity_statistics', 'nid', 'entity_id', $entity_id_column);[m [32m+[m[32m}[m [32m+[m [32m+[m[32m/**[m [32m+[m[32m * Rename variable names[m [32m+[m[32m */[m [32m+[m[32mfunction ___comment_update_8002() {[m [32m+[m[32m}[m [1mdiff --git a/modules/comment/comment.module b/modules/comment/comment.module[m [1mindex ae9278c..cfeff4f 100644[m [1m--- a/modules/comment/comment.module[m [1m+++ b/modules/comment/comment.module[m [36m@@ -57,17 +57,17 @@[m [mdefine('COMMENT_FORM_BELOW', 1);[m /**[m * Comments for this node are hidden.[m */[m [31m-define('COMMENT_NODE_HIDDEN', 0);[m [32m+[m[32mdefine('COMMENT_ENTITY_HIDDEN', 0);[m [m /**[m * Comments for this node are closed.[m */[m [31m-define('COMMENT_NODE_CLOSED', 1);[m [32m+[m[32mdefine('COMMENT_ENTITY_CLOSED', 1);[m [m /**[m * Comments for this node are open.[m */[m [31m-define('COMMENT_NODE_OPEN', 2);[m [32m+[m[32mdefine('COMMENT_ENTITY_OPEN', 2);[m [m /**[m * Implements hook_help().[m [36m@@ -609,143 +609,158 @@[m [mfunction theme_comment_block() {[m }[m [m /**[m [31m- * Implements hook_node_view().[m [32m+[m[32m * @TODO: Implements hook_entity_view().[m */[m [31m-function comment_node_view($node, $view_mode) {[m [31m- $links = array();[m [32m+[m[32mfunction comment_entity_view($entity, $entity_type, $view_mode, $langcode) {[m [32m+[m[32m // Entity does not support comment, we do nothing[m [32m+[m[32m if (!isset($entity->comment)) {[m [32m+[m[32m return;[m [32m+[m[32m }[m [m [31m- if ($node->comment != COMMENT_NODE_HIDDEN) {[m [31m- if ($view_mode == 'rss') {[m [31m- // Add a comments RSS element which is a URL to the comments of this node.[m [31m- $node->rss_elements[] = array([m [31m- 'key' => 'comments',[m [31m- 'value' => url('node/' . $node->nid, array('fragment' => 'comments', 'absolute' => TRUE))[m [31m- );[m [31m- }[m [31m- elseif ($view_mode == 'teaser') {[m [31m- // Teaser view: display the number of comments that have been posted,[m [31m- // or a link to add new comments if the user has permission, the node[m [31m- // is open to new comments, and there currently are none.[m [31m- if (user_access('access comments')) {[m [31m- if (!empty($node->comment_count)) {[m [31m- $links['comment-comments'] = array([m [31m- 'title' => format_plural($node->comment_count, '1 comment', '@count comments'),[m [31m- 'href' => "node/$node->nid",[m [31m- 'attributes' => array('title' => t('Jump to the first comment of this posting.')),[m [31m- 'fragment' => 'comments',[m [32m+[m[32m // Comment is hidden, we do nothing[m [32m+[m[32m if ($entity->comment == COMMENT_ENTITY_HIDDEN) {[m [32m+[m[32m return;[m [32m+[m[32m }[m [32m+[m [32m+[m[32m $entity_info = entity_get_info($entity_type);[m [32m+[m[32m $id_key = $entity_info['entity keys']['id'];[m [32m+[m[32m $bundle_key = $entity_info['entity keys']['bundle'];[m [32m+[m [32m+[m[32m if ($view_mode === 'rss') { # TODO[m [32m+[m[32m// // Add a comments RSS element which is a URL to the comments of this node.[m [32m+[m[32m// $node->rss_elements[] = array([m [32m+[m[32m// 'key' => 'comments',[m [32m+[m[32m// 'value' => url('node/' . $node->nid, array('fragment' => 'comments', 'absolute' => TRUE))[m [32m+[m[32m// );[m [32m+[m[32m }[m [32m+[m[32m elseif ($view_mode === 'teaser') {[m [32m+[m[32m // Teaser view: display the number of comments that have been posted,[m [32m+[m[32m // or a link to add new comments if the user has permission, the node[m [32m+[m[32m // is open to new comments, and there currently are none.[m [32m+[m[32m if (user_access('access comments')) {[m [32m+[m[32m if (!empty($entity->comment_count)) {[m [32m+[m[32m $links['comment-comments'] = array([m [32m+[m[32m 'title' => format_plural($entity->comment_count, '1 comment', '@count comments'),[m [32m+[m[32m 'href' => $entity_type . '/' . $entity->{$id_key}, # @TODO: Check this[m [32m+[m[32m 'attributes' => array('title' => t('Jump to the first comment of this posting.')),[m [32m+[m[32m 'fragment' => 'comments',[m [32m+[m[32m 'html' => TRUE,[m [32m+[m[32m );[m [32m+[m[32m // Show a link to the first new comment.[m [32m+[m[32m if ($new = comment_num_new($entity->{$id_key})) {[m [32m+[m[32m $links['comment-new-comments'] = array([m [32m+[m[32m 'title' => format_plural($new, '1 new comment', '@count new comments'),[m [32m+[m[32m 'href' => $entity_type . '/' . $entity->{$id_key}, # @TODO: Check this[m [32m+[m[32m 'query' => comment_new_page_count($entity->comment_count, $new, $entity),[m [32m+[m[32m 'attributes' => array('title' => t('Jump to the first new comment of this posting.')),[m [32m+[m[32m 'fragment' => 'new',[m 'html' => TRUE,[m );[m [31m- // Show a link to the first new comment.[m [31m- if ($new = comment_num_new($node->nid)) {[m [31m- $links['comment-new-comments'] = array([m [31m- 'title' => format_plural($new, '1 new comment', '@count new comments'),[m [31m- 'href' => "node/$node->nid",[m [31m- 'query' => comment_new_page_count($node->comment_count, $new, $node),[m [31m- 'attributes' => array('title' => t('Jump to the first new comment of this posting.')),[m [31m- 'fragment' => 'new',[m [31m- 'html' => TRUE,[m [31m- );[m [31m- }[m }[m }[m [31m- if ($node->comment == COMMENT_NODE_OPEN) {[m [31m- if (user_access('post comments')) {[m [32m+[m[32m }[m [32m+[m[32m if ($entity->comment == COMMENT_ENTITY_OPEN) {[m [32m+[m[32m if (user_access('post comments')) {[m [32m+[m[32m $links['comment-add'] = array([m [32m+[m[32m 'title' => t('Add new comment'),[m [32m+[m[32m 'href' => "comment/reply/{$entity_type}/{$entity->nid}",[m [32m+[m[32m 'attributes' => array('title' => t('Add a new comment to this page.')),[m [32m+[m[32m 'fragment' => 'comment-form',[m [32m+[m[32m );[m [32m+[m[32m }[m [32m+[m[32m else {[m [32m+[m[32m $links['comment-forbidden'] = array([m [32m+[m[32m 'title' => theme('comment_post_forbidden', array('entity' => $entity, 'entity_type' => $entity_type)),[m [32m+[m[32m 'html' => TRUE,[m [32m+[m[32m );[m [32m+[m[32m }[m [32m+[m[32m }[m [32m+[m[32m }[m [32m+[m[32m elseif ($view_mode != 'search_index' && $view_mode != 'search_result') {[m [32m+[m[32m // Node in other view modes: add a "post comment" link if the user is[m [32m+[m[32m // allowed to post comments and if this node is allowing new comments.[m [32m+[m[32m // But we don't want this link if we're building the node for search[m [32m+[m[32m // indexing or constructing a search result excerpt.[m [32m+[m[32m if ($entity->comment == COMMENT_ENTITY_OPEN) {[m [32m+[m[32m if (user_access('post comments')) {[m [32m+[m[32m $comment_form_location = variable_get("comment_form_location_{$entity_type}_" . $entity->{$bundle_key}, COMMENT_FORM_BELOW);[m [32m+[m[41m [m [32m+[m[32m // Show the "post comment" link if the form is on another page, or[m [32m+[m[32m // if there are existing comments that the link will skip past.[m [32m+[m[32m if ($comment_form_location == COMMENT_FORM_SEPARATE_PAGE || (!empty($entity->comment_count) && user_access('access comments'))) {[m $links['comment-add'] = array([m 'title' => t('Add new comment'),[m [31m- 'href' => "comment/reply/$node->nid",[m [31m- 'attributes' => array('title' => t('Add a new comment to this page.')),[m [32m+[m[32m 'attributes' => array('title' => t('Share your thoughts and opinions related to this posting.')),[m [32m+[m[32m 'href' => $entity_type . '/' . $entity->{$id_key},[m 'fragment' => 'comment-form',[m );[m [31m- }[m [31m- else {[m [31m- $links['comment-forbidden'] = array([m [31m- 'title' => theme('comment_post_forbidden', array('node' => $node)),[m [31m- 'html' => TRUE,[m [31m- );[m [31m- }[m [31m- }[m [31m- }[m [31m- elseif ($view_mode != 'search_index' && $view_mode != 'search_result') {[m [31m- // Node in other view modes: add a "post comment" link if the user is[m [31m- // allowed to post comments and if this node is allowing new comments.[m [31m- // But we don't want this link if we're building the node for search[m [31m- // indexing or constructing a search result excerpt.[m [31m- if ($node->comment == COMMENT_NODE_OPEN) {[m [31m- $comment_form_location = variable_get('comment_form_location_' . $node->type, COMMENT_FORM_BELOW);[m [31m- if (user_access('post comments')) {[m [31m- // Show the "post comment" link if the form is on another page, or[m [31m- // if there are existing comments that the link will skip past.[m [31m- if ($comment_form_location == COMMENT_FORM_SEPARATE_PAGE || (!empty($node->comment_count) && user_access('access comments'))) {[m [31m- $links['comment-add'] = array([m [31m- 'title' => t('Add new comment'),[m [31m- 'attributes' => array('title' => t('Share your thoughts and opinions related to this posting.')),[m [31m- 'href' => "node/$node->nid",[m [31m- 'fragment' => 'comment-form',[m [31m- );[m [31m- if ($comment_form_location == COMMENT_FORM_SEPARATE_PAGE) {[m [31m- $links['comment-add']['href'] = "comment/reply/$node->nid";[m [31m- }[m [32m+[m[32m if ($comment_form_location == COMMENT_FORM_SEPARATE_PAGE) {[m [32m+[m[32m $links['comment-add']['href'] = "comment/reply/{$entity_type}/" . $entity->{$id_key};[m }[m }[m [31m- else {[m [31m- $links['comment-forbidden'] = array([m [31m- 'title' => theme('comment_post_forbidden', array('node' => $node)),[m [31m- 'html' => TRUE,[m [31m- );[m [31m- }[m [32m+[m[32m }[m [32m+[m[32m else {[m [32m+[m[32m $links['comment-forbidden'] = array([m [32m+[m[32m 'title' => theme('comment_post_forbidden', array('entity' => $entity, 'entity_type' => $entity_type)),[m [32m+[m[32m 'html' => TRUE,[m [32m+[m[32m );[m }[m }[m [32m+[m[32m }[m [m [31m- $node->content['links']['comment'] = array([m [31m- '#theme' => 'links__node__comment',[m [31m- '#links' => $links,[m [31m- '#attributes' => array('class' => array('links', 'inline')),[m [31m- );[m [32m+[m[32m $entity->content['links']['comment'] = array([m [32m+[m[32m '#theme' => 'links__node__comment',[m [32m+[m[32m '#links' => $links,[m [32m+[m[32m '#attributes' => array('class' => array('links', 'inline')),[m [32m+[m[32m );[m [m [31m- // Only append comments when we are building a node on its own node detail[m [31m- // page. We compare $node and $page_node to ensure that comments are not[m [31m- // appended to other nodes shown on the page, for example a node_reference[m [31m- // displayed in 'full' view mode within another node.[m [31m- if ($node->comment && $view_mode == 'full' && node_is_page($node) && empty($node->in_preview)) {[m [31m- $node->content['comments'] = comment_node_page_additions($node);[m [31m- }[m [32m+[m[32m // Only append comments when we are building a node on its own node detail[m [32m+[m[32m // page. We compare $node and $page_node to ensure that comments are not[m [32m+[m[32m // appended to other nodes shown on the page, for example a node_reference[m [32m+[m[32m // displayed in 'full' view mode within another node.[m [32m+[m[32m if ($entity->comment && $view_mode == 'full' && empty($entity->in_preview)) { # @TODO: && node_is_page($entity)[m [32m+[m[32m $entity->content['comments'] = comment_entity_page_additions($entity, $entity_type);[m }[m }[m [m /**[m * Build the comment-related elements for node detail pages.[m *[m [31m- * @param $node[m [32m+[m[32m * @param $entity[m * A node object.[m */[m [31m-function comment_node_page_additions($node) {[m [32m+[m[32mfunction comment_entity_page_additions($entity, $entity_type) {[m $additions = array();[m [m [32m+[m[32m $entity_info = entity_get_info($entity_type);[m [32m+[m[32m $id_key = $entity_info['entity keys']['id'];[m [32m+[m[32m $bundle_key = $entity_info['entity keys']['bundle'];[m [32m+[m // Only attempt to render comments if the node has visible comments.[m // Unpublished comments are not included in $node->comment_count, so show[m // comments unconditionally if the user is an administrator.[m [31m- if (($node->comment_count && user_access('access comments')) || user_access('administer comments')) {[m [31m- $mode = variable_get('comment_default_mode_' . $node->type, COMMENT_MODE_THREADED);[m [31m- $comments_per_page = variable_get('comment_default_per_page_' . $node->type, 50);[m [31m- if ($cids = comment_get_thread($node, $mode, $comments_per_page)) {[m [32m+[m[32m if (($entity->comment_count && user_access('access comments')) || user_access('administer comments')) {[m [32m+[m[32m $mode = variable_get("comment_default_mode_{$entity_type}_" . $entity->{$bundle_key}, COMMENT_MODE_THREADED);[m [32m+[m[32m $comments_per_page = variable_get("comment_default_per_page_{$entity_type}_" . $entity->{$bundle_key}, 50);[m [32m+[m[32m if ($cids = comment_get_thread($entity, $mode, $comments_per_page)) {[m $comments = comment_load_multiple($cids);[m comment_prepare_thread($comments);[m [31m- $build = comment_view_multiple($comments, $node);[m [32m+[m[32m $build = comment_view_multiple($comments, $entity);[m $build['pager']['#theme'] = 'pager';[m $additions['comments'] = $build;[m }[m }[m [m // Append comment form if needed.[m [31m- if (user_access('post comments') && $node->comment == COMMENT_NODE_OPEN && (variable_get('comment_form_location_' . $node->type, COMMENT_FORM_BELOW) == COMMENT_FORM_BELOW)) {[m [31m- $build = drupal_get_form("comment_node_{$node->type}_form", (object) array('nid' => $node->nid));[m [32m+[m[32m if (user_access('post comments') && $entity->comment == COMMENT_ENTITY_OPEN && (variable_get("comment_form_location_{$entity_type}_". $entity->{$bundle_key}, COMMENT_FORM_BELOW) == COMMENT_FORM_BELOW)) {[m [32m+[m[32m $build = drupal_get_form("comment_entity_{$entity_type}_". $entity->{$bundle_key} ."_form", (object) array('entity_type' => $entity_type, 'entity_id' => $entity->nid));[m $additions['comment_form'] = $build;[m }[m [m if ($additions) {[m $additions += array([m [31m- '#theme' => 'comment_wrapper__node_' . $node->type,[m [31m- '#node' => $node,[m [32m+[m[32m '#theme' => 'comment_wrapper__node_' . $entity->type,[m [32m+[m[32m '#entity' => $entity,[m 'comments' => array(),[m 'comment_form' => array(),[m );[m [36m@@ -1028,7 +1043,7 @@[m [mfunction comment_build_content($comment, $node, $view_mode = 'full', $langcode =[m */[m function comment_links($comment, $node) {[m $links = array();[m [31m- if ($node->comment == COMMENT_NODE_OPEN) {[m [32m+[m[32m if ($node->comment == COMMENT_ENTITY_OPEN) {[m if (user_access('administer comments') && user_access('post comments')) {[m $links['comment-delete'] = array([m 'title' => t('delete'),[m [36m@@ -1133,29 +1148,29 @@[m [mfunction comment_form_node_type_form_alter(&$form, $form_state) {[m $form['comment']['comment'] = array([m '#type' => 'select',[m '#title' => t('Default comment setting for new content'),[m [31m- '#default_value' => variable_get('comment_' . $form['#node_type']->type, COMMENT_NODE_OPEN),[m [32m+[m[32m '#default_value' => variable_get('comment_node_' . $form['#node_type']->type, COMMENT_ENTITY_OPEN),[m '#options' => array([m [31m- COMMENT_NODE_OPEN => t('Open'),[m [31m- COMMENT_NODE_CLOSED => t('Closed'),[m [31m- COMMENT_NODE_HIDDEN => t('Hidden'),[m [32m+[m[32m COMMENT_ENTITY_OPEN => t('Open'),[m [32m+[m[32m COMMENT_ENTITY_CLOSED => t('Closed'),[m [32m+[m[32m COMMENT_ENTITY_HIDDEN => t('Hidden'),[m ),[m );[m $form['comment']['comment_default_mode'] = array([m '#type' => 'checkbox',[m '#title' => t('Threading'),[m [31m- '#default_value' => variable_get('comment_default_mode_' . $form['#node_type']->type, COMMENT_MODE_THREADED),[m [32m+[m[32m '#default_value' => variable_get('comment_default_mode_node_' . $form['#node_type']->type, COMMENT_MODE_THREADED),[m '#description' => t('Show comment replies in a threaded list.'),[m );[m $form['comment']['comment_default_per_page'] = array([m '#type' => 'select',[m '#title' => t('Comments per page'),[m [31m- '#default_value' => variable_get('comment_default_per_page_' . $form['#node_type']->type, 50),[m [32m+[m[32m '#default_value' => variable_get('comment_default_per_page_node_' . $form['#node_type']->type, 50),[m '#options' => _comment_per_page(),[m );[m $form['comment']['comment_anonymous'] = array([m '#type' => 'select',[m '#title' => t('Anonymous commenting'),[m [31m- '#default_value' => variable_get('comment_anonymous_' . $form['#node_type']->type, COMMENT_ANONYMOUS_MAYNOT_CONTACT),[m [32m+[m[32m '#default_value' => variable_get('comment_anonymous_node_' . $form['#node_type']->type, COMMENT_ANONYMOUS_MAYNOT_CONTACT),[m '#options' => array([m COMMENT_ANONYMOUS_MAYNOT_CONTACT => t('Anonymous posters may not enter their contact information'),[m COMMENT_ANONYMOUS_MAY_CONTACT => t('Anonymous posters may leave their contact information'),[m [36m@@ -1166,17 +1181,17 @@[m [mfunction comment_form_node_type_form_alter(&$form, $form_state) {[m $form['comment']['comment_subject_field'] = array([m '#type' => 'checkbox',[m '#title' => t('Allow comment title'),[m [31m- '#default_value' => variable_get('comment_subject_field_' . $form['#node_type']->type, 1),[m [32m+[m[32m '#default_value' => variable_get('comment_subject_field_node_' . $form['#node_type']->type, 1),[m );[m $form['comment']['comment_form_location'] = array([m '#type' => 'checkbox',[m '#title' => t('Show reply form on the same page as comments'),[m [31m- '#default_value' => variable_get('comment_form_location_' . $form['#node_type']->type, COMMENT_FORM_BELOW),[m [32m+[m[32m '#default_value' => variable_get('comment_form_location_node_' . $form['#node_type']->type, COMMENT_FORM_BELOW),[m );[m $form['comment']['comment_preview'] = array([m '#type' => 'radios',[m '#title' => t('Preview comment'),[m [31m- '#default_value' => variable_get('comment_preview_' . $form['#node_type']->type, DRUPAL_OPTIONAL),[m [32m+[m[32m '#default_value' => variable_get('comment_preview_node_' . $form['#node_type']->type, DRUPAL_OPTIONAL),[m '#options' => array([m DRUPAL_DISABLED => t('Disabled'),[m DRUPAL_OPTIONAL => t('Optional'),[m [36m@@ -1207,7 +1222,7 @@[m [mfunction comment_form_node_form_alter(&$form, $form_state) {[m '#weight' => 30,[m );[m $comment_count = isset($node->nid) ? db_query('SELECT comment_count FROM {node_comment_statistics} WHERE nid = :nid', array(':nid' => $node->nid))->fetchField() : 0;[m [31m- $comment_settings = ($node->comment == COMMENT_NODE_HIDDEN && empty($comment_count)) ? COMMENT_NODE_CLOSED : $node->comment;[m [32m+[m[32m $comment_settings = ($node->comment == COMMENT_ENTITY_HIDDEN && empty($comment_count)) ? COMMENT_ENTITY_CLOSED : $node->comment;[m $form['comment_settings']['comment'] = array([m '#type' => 'radios',[m '#title' => t('Comments'),[m [36m@@ -1215,60 +1230,68 @@[m [mfunction comment_form_node_form_alter(&$form, $form_state) {[m '#parents' => array('comment'),[m '#default_value' => $comment_settings,[m '#options' => array([m [31m- COMMENT_NODE_OPEN => t('Open'),[m [31m- COMMENT_NODE_CLOSED => t('Closed'),[m [31m- COMMENT_NODE_HIDDEN => t('Hidden'),[m [32m+[m[32m COMMENT_ENTITY_OPEN => t('Open'),[m [32m+[m[32m COMMENT_ENTITY_CLOSED => t('Closed'),[m [32m+[m[32m COMMENT_ENTITY_HIDDEN => t('Hidden'),[m ),[m [31m- COMMENT_NODE_OPEN => array([m [32m+[m[32m COMMENT_ENTITY_OPEN => array([m '#description' => t('Users with the "Post comments" permission can post comments.'),[m ),[m [31m- COMMENT_NODE_CLOSED => array([m [32m+[m[32m COMMENT_ENTITY_CLOSED => array([m '#description' => t('Users cannot post comments, but existing comments will be displayed.'),[m ),[m [31m- COMMENT_NODE_HIDDEN => array([m [32m+[m[32m COMMENT_ENTITY_HIDDEN => array([m '#description' => t('Comments are hidden from view.'),[m ),[m );[m // If the node doesn't have any comments, the "hidden" option makes no[m // sense, so don't even bother presenting it to the user.[m if (empty($comment_count)) {[m [31m- unset($form['comment_settings']['comment']['#options'][COMMENT_NODE_HIDDEN]);[m [31m- unset($form['comment_settings']['comment'][COMMENT_NODE_HIDDEN]);[m [31m- $form['comment_settings']['comment'][COMMENT_NODE_CLOSED]['#description'] = t('Users cannot post comments.');[m [32m+[m[32m unset($form['comment_settings']['comment']['#options'][COMMENT_ENTITY_HIDDEN]);[m [32m+[m[32m unset($form['comment_settings']['comment'][COMMENT_ENTITY_HIDDEN]);[m [32m+[m[32m $form['comment_settings']['comment'][COMMENT_ENTITY_CLOSED]['#description'] = t('Users cannot post comments.');[m }[m }[m [m /**[m [31m- * Implements hook_node_load().[m [32m+[m[32m * Implements hook_entity_load().[m */[m [31m-function comment_node_load($nodes, $types) {[m [31m- $comments_enabled = array();[m [32m+[m[32mfunction comment_entity_load($entities, $entity_type) {[m [32m+[m[32m $entity_info = entity_get_info($entity_type);[m [m [31m- // Check if comments are enabled for each node. If comments are disabled,[m [31m- // assign values without hitting the database.[m [31m- foreach ($nodes as $node) {[m [32m+[m[32m // Entity does not support comment, we do nothing.[m [32m+[m[32m if (empty($entity_info['comment'])) {[m [32m+[m[32m return;[m [32m+[m[32m }[m [32m+[m [32m+[m[32m # dsm($entity_info); return;[m [32m+[m[32m $id_field = $entity_info['entity keys']['id'];[m [32m+[m [32m+[m[32m $comments_enabled = array();[m [32m+[m[32m foreach ($entities as $entity) {[m // Store whether comments are enabled for this node.[m [31m- if ($node->comment != COMMENT_NODE_HIDDEN) {[m [31m- $comments_enabled[] = $node->nid;[m [32m+[m[32m if ($entity->comment != COMMENT_ENTITY_HIDDEN) {[m [32m+[m[32m $comments_enabled[] = $entity->{$id_field};[m }[m else {[m [31m- $node->cid = 0;[m [31m- $node->last_comment_timestamp = $node->created;[m [31m- $node->last_comment_name = '';[m [31m- $node->last_comment_uid = $node->uid;[m [31m- $node->comment_count = 0;[m [32m+[m[32m $entity->cid = 0;[m [32m+[m[32m $entity->last_comment_timestamp = isset($entity->created) ? $entity->created : NULL;[m [32m+[m[32m $entity->last_comment_name = '';[m [32m+[m[32m $entity->last_comment_uid = $entity->uid;[m [32m+[m[32m $entity->last_comment_uid = isset($entity->uid) ? $entity->uid : 0;[m [32m+[m[32m $entity->comment_count = 0;[m }[m }[m [m // For nodes with comments enabled, fetch information from the database.[m if (!empty($comments_enabled)) {[m [31m- $result = db_query('SELECT nid, cid, last_comment_timestamp, last_comment_name, last_comment_uid, comment_count FROM {node_comment_statistics} WHERE nid IN (:comments_enabled)', array(':comments_enabled' => $comments_enabled));[m [32m+[m[32m $result = db_query('SELECT cid, entity_id, last_comment_timestamp, last_comment_name, last_comment_uid, comment_count FROM {comment_entity_statistics} WHERE entity_type = :entity_type AND entity_id IN (:comments_enabled)', array(':entity_type' => $entity_type, ':comments_enabled' => $comments_enabled));[m foreach ($result as $record) {[m [31m- $nodes[$record->nid]->cid = $record->cid;[m [31m- $nodes[$record->nid]->last_comment_timestamp = $record->last_comment_timestamp;[m [31m- $nodes[$record->nid]->last_comment_name = $record->last_comment_name;[m [31m- $nodes[$record->nid]->last_comment_uid = $record->last_comment_uid;[m [31m- $nodes[$record->nid]->comment_count = $record->comment_count;[m [32m+[m[32m $entities[$record->entity_id]->cid = $record->cid;[m [32m+[m[32m $entities[$record->entity_id]->last_comment_timestamp = $record->last_comment_timestamp;[m [32m+[m[32m $entities[$record->entity_id]->last_comment_name = $record->last_comment_name;[m [32m+[m[32m $entities[$record->entity_id]->last_comment_uid = $record->last_comment_uid;[m [32m+[m[32m $entities[$record->entity_id]->comment_count = $record->comment_count;[m }[m }[m }[m [36m@@ -1278,7 +1301,7 @@[m [mfunction comment_node_load($nodes, $types) {[m */[m function comment_node_prepare($node) {[m if (!isset($node->comment)) {[m [31m- $node->comment = variable_get("comment_$node->type", COMMENT_NODE_OPEN);[m [32m+[m[32m $node->comment = variable_get("comment_$node->type", COMMENT_ENTITY_OPEN);[m }[m }[m [m [36m@@ -1367,11 +1390,11 @@[m [mfunction comment_update_index() {[m */[m function comment_node_search_result($node) {[m // Do not make a string if comments are hidden.[m [31m- if (user_access('access comments') && $node->comment != COMMENT_NODE_HIDDEN) {[m [32m+[m[32m if (user_access('access comments') && $node->comment != COMMENT_ENTITY_HIDDEN) {[m $comments = db_query('SELECT comment_count FROM {node_comment_statistics} WHERE nid = :nid', array('nid' => $node->nid))->fetchField();[m // Do not make a string if comments are closed and there are currently[m // zero comments.[m [31m- if ($node->comment != COMMENT_NODE_CLOSED || $comments > 0) {[m [32m+[m[32m if ($node->comment != COMMENT_ENTITY_CLOSED || $comments > 0) {[m return array('comment' => format_plural($comments, '1 comment', '@count comments'));[m }[m }[m [36m@@ -1440,6 +1463,8 @@[m [mfunction comment_access($op, $comment) {[m * @see comment_int_to_alphadecimal()[m */[m function comment_save($comment) {[m [32m+[m[32m kpr($comment);[m [32m+[m[32m exit;[m global $user;[m [m $transaction = db_transaction();[m [36m@@ -1481,7 +1506,7 @@[m [mfunction comment_save($comment) {[m db_ignore_slave();[m [m // Update the {node_comment_statistics} table prior to executing hooks.[m [31m- _comment_update_node_statistics($comment->nid);[m [32m+[m[32m _comment_update_entity_statistics($comment->nid);[m [m field_attach_update('comment', $comment);[m // Allow modules to respond to the updating of a comment.[m [36m@@ -1562,7 +1587,7 @@[m [mfunction comment_save($comment) {[m db_ignore_slave();[m [m // Update the {node_comment_statistics} table prior to executing hooks.[m [31m- _comment_update_node_statistics($comment->nid);[m [32m+[m[32m _comment_update_entity_statistics($comment->nid);[m [m field_attach_insert('comment', $comment);[m [m [36m@@ -1616,7 +1641,7 @@[m [mfunction comment_delete_multiple($cids) {[m // Delete the comment's replies.[m $child_cids = db_query('SELECT cid FROM {comment} WHERE pid = :cid', array(':cid' => $comment->cid))->fetchCol();[m comment_delete_multiple($child_cids);[m [31m- _comment_update_node_statistics($comment->nid);[m [32m+[m[32m _comment_update_entity_statistics($comment->nid);[m }[m }[m catch (Exception $e) {[m [36m@@ -1810,9 +1835,15 @@[m [mfunction comment_edit_page($comment) {[m */[m function comment_forms() {[m $forms = array();[m [31m- foreach (node_type_get_types() as $type) {[m [31m- $forms["comment_node_{$type->type}_form"]['callback'] = 'comment_form';[m [32m+[m [32m+[m[32m foreach (entity_get_info() as $entity_type => $entity_info) {[m [32m+[m[32m if (!empty($entity_info['comment'])) {[m [32m+[m[32m foreach ($entity_info['bundles'] as $bundle_type => $bundle) {[m [32m+[m[32m $forms["comment_entity_{$entity_type}_{$bundle_type}_form"]['callback'] = 'comment_form';[m [32m+[m[32m }[m [32m+[m[32m }[m }[m [32m+[m return $forms;[m }[m [m [36m@@ -1853,14 +1884,18 @@[m [mfunction comment_form($form, &$form_state, $comment) {[m $comment = $form_state['comment'];[m }[m [m [31m- $node = node_load($comment->nid);[m [31m- $form['#node'] = $node;[m [32m+[m[32m $entity_info = entity_get_info($comment->entity_type);[m [32m+[m[32m $id_key = $entity_info['entity keys']['id'];[m [32m+[m[32m $bundle_key = $entity_info['bundle keys']['bundle'];[m [32m+[m[32m $entity = entity_load($comment->entity_type, array($comment->entity_id));[m [32m+[m[32m $entity = reset($entity);[m [32m+[m[32m $form['#entity'] = $entity;[m [m [31m- // Use #comment-form as unique jump target, regardless of node type.[m [32m+[m[32m // Use #comment-form as unique jump target, regardless of entity/bundle.[m $form['#id'] = drupal_html_id('comment_form');[m [31m- $form['#theme'] = array('comment_form__node_' . $node->type, 'comment_form');[m [32m+[m[32m $form['#theme'] = array("comment_form__entity_{$comment->entity_type}_" . $entity->{$bundle_key}, 'comment_form');[m [m [31m- $anonymous_contact = variable_get('comment_anonymous_' . $node->type, COMMENT_ANONYMOUS_MAYNOT_CONTACT);[m [32m+[m[32m $anonymous_contact = variable_get("comment_anonymous_{$comment->entity_type}_" . $entity->{$bundle_key}, COMMENT_ANONYMOUS_MAYNOT_CONTACT);[m $is_admin = (!empty($comment->cid) && user_access('administer comments'));[m [m if (!$user->uid && $anonymous_contact != COMMENT_ANONYMOUS_MAYNOT_CONTACT) {[m [36m@@ -1871,7 +1906,7 @@[m [mfunction comment_form($form, &$form_state, $comment) {[m // If not replying to a comment, use our dedicated page callback for new[m // comments on nodes.[m if (empty($comment->cid) && empty($comment->pid)) {[m [31m- $form['#action'] = url('comment/reply/' . $comment->nid);[m [32m+[m[32m $form['#action'] = url("comment/reply/{$comment->entity_type}/" . $entity->{$id_key});[m }[m [m if (isset($form_state['comment_preview'])) {[m [36m@@ -1991,7 +2026,7 @@[m [mfunction comment_form($form, &$form_state, $comment) {[m '#title' => t('Subject'),[m '#maxlength' => 64,[m '#default_value' => $comment->subject,[m [31m- '#access' => variable_get('comment_subject_field_' . $node->type, 1) == 1,[m [32m+[m[32m '#access' => variable_get("comment_subject_field_{$comment->entity_type}_" . $entity->{$bundle_key}, 1) == 1,[m '#weight' => -1,[m );[m [m [36m@@ -2002,10 +2037,12 @@[m [mfunction comment_form($form, &$form_state, $comment) {[m );[m [m // Add internal comment properties.[m [31m- foreach (array('cid', 'pid', 'nid', 'language', 'uid') as $key) {[m [32m+[m[32m foreach (array('cid', 'pid', 'entity_type', 'entity_id', 'language', 'uid') as $key) {[m $form[$key] = array('#type' => 'value', '#value' => $comment->$key);[m }[m [31m- $form['node_type'] = array('#type' => 'value', '#value' => 'comment_node_' . $node->type);[m [32m+[m [32m+[m[32m $form['entity_type'] = array('#type' => 'value', '#value' => $comment->entity_type);[m [32m+[m[32m $form['bundle_type'] = array('#type' => 'value', '#value' => $entity->{$bundle_key});[m [m // Only show the save button if comment previews are optional or if we are[m // already previewing the submission.[m [36m@@ -2013,19 +2050,19 @@[m [mfunction comment_form($form, &$form_state, $comment) {[m $form['actions']['submit'] = array([m '#type' => 'submit',[m '#value' => t('Save'),[m [31m- '#access' => ($comment->cid && user_access('administer comments')) || variable_get('comment_preview_' . $node->type, DRUPAL_OPTIONAL) != DRUPAL_REQUIRED || isset($form_state['comment_preview']),[m [32m+[m[32m '#access' => ($comment->cid && user_access('administer comments')) || variable_get('comment_preview_' . $entity->type, DRUPAL_OPTIONAL) != DRUPAL_REQUIRED || isset($form_state['comment_preview']),[m '#weight' => 19,[m );[m $form['actions']['preview'] = array([m '#type' => 'submit',[m '#value' => t('Preview'),[m [31m- '#access' => (variable_get('comment_preview_' . $node->type, DRUPAL_OPTIONAL) != DRUPAL_DISABLED),[m [32m+[m[32m '#access' => (variable_get('comment_preview_' . $entity->type, DRUPAL_OPTIONAL) != DRUPAL_DISABLED),[m '#weight' => 20,[m '#submit' => array('comment_form_build_preview'),[m );[m [m // Attach fields.[m [31m- $comment->node_type = 'comment_node_' . $node->type;[m [32m+[m[32m $comment->node_type = 'comment_node_' . $entity->type;[m field_attach_form('comment', $comment, $form, $form_state);[m [m return $form;[m [36m@@ -2213,7 +2250,7 @@[m [mfunction comment_form_submit_build_comment($form, &$form_state) {[m function comment_form_submit($form, &$form_state) {[m $node = node_load($form_state['values']['nid']);[m $comment = comment_form_submit_build_comment($form, $form_state);[m [31m- if (user_access('post comments') && (user_access('administer comments') || $node->comment == COMMENT_NODE_OPEN)) {[m [32m+[m[32m if (user_access('post comments') && (user_access('administer comments') || $node->comment == COMMENT_ENTITY_OPEN)) {[m // Save the anonymous user information to a cookie for reuse.[m if (user_is_anonymous()) {[m user_cookie_save(array_intersect_key($form_state['values'], array_flip(array('name', 'mail', 'homepage'))));[m [36m@@ -2371,8 +2408,8 @@[m [mfunction theme_comment_post_forbidden($variables) {[m */[m function template_preprocess_comment_wrapper(&$variables) {[m // Provide contextual information.[m [31m- $variables['node'] = $variables['content']['#node'];[m [31m- $variables['display_mode'] = variable_get('comment_default_mode_' . $variables['node']->type, COMMENT_MODE_THREADED);[m [32m+[m[32m $variables['entity'] = $variables['content']['#entity'];[m [32m+[m[32m $variables['display_mode'] = variable_get('comment_default_mode_' . $variables['entity']->type, COMMENT_MODE_THREADED);[m // The comment form is optional and may not exist.[m $variables['content'] += array('comment_form' => array());[m }[m [36m@@ -2399,7 +2436,7 @@[m [mfunction _comment_per_page() {[m }[m [m /**[m [31m- * Updates the comment statistics for a given node. This should be called any[m [32m+[m[32m * Updates the comment statistics for a given entity. This should be called any[m * time a comment is added, deleted, or updated.[m *[m * The following fields are contained in the node_comment_statistics table.[m [36m@@ -2408,25 +2445,27 @@[m [mfunction _comment_per_page() {[m * - last_comment_uid: the uid of the poster for the last comment for this node or the node authors uid if no comments exists for the node.[m * - comment_count: the total number of approved/published comments on this node.[m */[m [31m-function _comment_update_node_statistics($nid) {[m [32m+[m[32mfunction _comment_update_entity_statistics($entity_type, $entiy_id) {[m // Allow bulk updates and inserts to temporarily disable the[m // maintenance of the {node_comment_statistics} table.[m [31m- if (!variable_get('comment_maintain_node_statistics', TRUE)) {[m [32m+[m[32m if (!variable_get("comment_maintain_{$entity_type}_statistics", TRUE)) {[m return;[m }[m [m [31m- $count = db_query('SELECT COUNT(cid) FROM {comment} WHERE nid = :nid AND status = :status', array([m [31m- ':nid' => $nid,[m [32m+[m[32m $count = db_query('SELECT COUNT(cid) FROM {comment} WHERE entity_type = :entity_type AND entiy_id = :entiy_id AND status = :status', array([m [32m+[m[32m ':entity_type' => $entity_type,[m [32m+[m[32m ':entiy_id' => $entiy_id,[m ':status' => COMMENT_PUBLISHED,[m ))->fetchField();[m [m if ($count > 0) {[m // Comments exist.[m [31m- $last_reply = db_query_range('SELECT cid, name, changed, uid FROM {comment} WHERE nid = :nid AND status = :status ORDER BY cid DESC', 0, 1, array([m [31m- ':nid' => $nid,[m [32m+[m[32m $last_reply = db_query_range('SELECT cid, name, changed, uid FROM {comment} WHERE entity_type = :entity_type AND entiy_id = :entiy_id AND status = :status ORDER BY cid DESC', 0, 1, array([m [32m+[m[32m ':entity_type' => $entity_type,[m [32m+[m[32m ':entiy_id' => $entiy_id,[m ':status' => COMMENT_PUBLISHED,[m ))->fetchObject();[m [31m- db_update('node_comment_statistics')[m [32m+[m[32m db_update('comment_entity_statistics')[m ->fields(array([m 'cid' => $last_reply->cid,[m 'comment_count' => $count,[m [36m@@ -2434,21 +2473,32 @@[m [mfunction _comment_update_node_statistics($nid) {[m 'last_comment_name' => $last_reply->uid ? '' : $last_reply->name,[m 'last_comment_uid' => $last_reply->uid,[m ))[m [31m- ->condition('nid', $nid)[m [32m+[m[32m ->condition('entity_type', $entity_type)[m [32m+[m[32m ->condition('entiy_id', $entiy_id)[m ->execute();[m }[m else {[m // Comments do not exist.[m [31m- $node = db_query('SELECT uid, created FROM {node} WHERE nid = :nid', array(':nid' => $nid))->fetchObject();[m [31m- db_update('node_comment_statistics')[m [32m+[m[32m $entity_info = entity_get_info($entity_type);[m [32m+[m [32m+[m[32m # Get entity uid, created[m [32m+[m[32m $entity = db_select($entity_info['base table'], 'entity')[m [32m+[m[32m ->fields('entity', array('uid', 'created')) # @TODO: How are we sure entity has uid and created columns?[m [32m+[m[32m ->condition('entity_type', $entity_type)[m [32m+[m[32m ->condition('entity_id', $entity_id)[m [32m+[m[32m ->execute()[m [32m+[m[32m ->fetchObject();[m [32m+[m [32m+[m[32m db_update('comment_entity_statistics')[m ->fields(array([m 'cid' => 0,[m 'comment_count' => 0,[m [31m- 'last_comment_timestamp' => $node->created,[m [32m+[m[32m 'last_comment_timestamp' => $entity->created,[m 'last_comment_name' => '',[m [31m- 'last_comment_uid' => $node->uid,[m [32m+[m[32m 'last_comment_uid' => $entity->uid,[m ))[m [31m- ->condition('nid', $nid)[m [32m+[m[32m ->condition('entity_type', $entity_type)[m [32m+[m[32m ->condition('entity_id', $entity_id)[m ->execute();[m }[m }[m [36m@@ -2717,3 +2767,32 @@[m [mfunction comment_file_download_access($field, $entity_type, $entity) {[m return FALSE;[m }[m }[m [32m+[m [32m+[m[32m/**[m [32m+[m[32m * Implements hook_schema_alter().[m [32m+[m[32m * Create comment field to entity base and revision tables.[m [32m+[m[32m */[m [32m+[m[32mfunction comment_schema_alter(&$schema) {[m [32m+[m[32m foreach (entity_get_info() as $entity_type => $entity_info) {[m [32m+[m[32m if (!empty($entity_info['comment'])) {[m [32m+[m[32m foreach (array('base table', 'revision table') as $i) {[m [32m+[m[32m if (isset($entity_info[$i])) {[m [32m+[m[32m $table_name = $entity_info[$i];[m [32m+[m[32m if (isset($schema[$table_name]) && !isset($schema[$table_name]['fields']['comment'])) {[m [32m+[m[32m $schema[$table_name]['fields']['comment'] = array([m [32m+[m[32m 'description' => 'Whether comments are allowed on this node: 0 = no, 1 = closed (read only), 2 = open (read/write).',[m [32m+[m[32m 'type' => 'int',[m [32m+[m[32m 'not null' => TRUE,[m [32m+[m[32m 'default' => 0,[m [32m+[m[32m );[m [32m+[m [32m+[m[32m try {[m [32m+[m[32m db_add_field($table_name, 'comment', $schema[$table_name]['fields']['comment']);[m [32m+[m[32m }[m [32m+[m[32m catch (Exception $e) {}[m [32m+[m[32m }[m [32m+[m[32m }[m [32m+[m[32m }[m [32m+[m[32m }[m [32m+[m[32m }[m [32m+[m[32m}[m [1mdiff --git a/modules/comment/comment.pages.inc b/modules/comment/comment.pages.inc[m [1mindex 7e88bff..851bbe0 100644[m [1m--- a/modules/comment/comment.pages.inc[m [1m+++ b/modules/comment/comment.pages.inc[m [36m@@ -81,7 +81,7 @@[m [mfunction comment_reply($node, $pid = NULL) {[m }[m [m // Should we show the reply box?[m [31m- if ($node->comment != COMMENT_NODE_OPEN) {[m [32m+[m[32m if ($node->comment != COMMENT_ENTITY_OPEN) {[m drupal_set_message(t("This discussion is closed: you can't post new comments."), 'error');[m drupal_goto("node/$node->nid");[m }[m [1mdiff --git a/modules/comment/comment.test b/modules/comment/comment.test[m [1mindex 2e96ba3..2a7896e 100644[m [1m--- a/modules/comment/comment.test[m [1m+++ b/modules/comment/comment.test[m [36m@@ -615,7 +615,7 @@[m [mclass CommentInterfaceTest extends CommentHelperCase {[m * USER_REGISTER_VISITORS.[m * - contact: COMMENT_ANONYMOUS_MAY_CONTACT or[m * COMMENT_ANONYMOUS_MAYNOT_CONTACT.[m [31m- * - comments: COMMENT_NODE_OPEN, COMMENT_NODE_CLOSED, or[m [32m+[m[32m * - comments: COMMENT_ENTITY_OPEN, COMMENT_NODE_CLOSED, or[m * COMMENT_NODE_HIDDEN.[m * - User permissions:[m * These are granted or revoked for the user, according to the[m [36m@@ -637,7 +637,7 @@[m [mclass CommentInterfaceTest extends CommentHelperCase {[m 'form' => COMMENT_FORM_BELOW,[m 'user_register' => USER_REGISTER_VISITORS,[m 'contact' => COMMENT_ANONYMOUS_MAY_CONTACT,[m [31m- 'comments' => COMMENT_NODE_OPEN,[m [32m+[m[32m 'comments' => COMMENT_ENTITY_OPEN,[m 'access comments' => 0,[m 'post comments' => 0,[m // Enabled by default, because it's irrelevant for this test.[m [36m@@ -715,9 +715,9 @@[m [mclass CommentInterfaceTest extends CommentHelperCase {[m COMMENT_ANONYMOUS_MUST_CONTACT => 'required',[m );[m $t_comments = array([m [31m- COMMENT_NODE_OPEN => 'open',[m [31m- COMMENT_NODE_CLOSED => 'closed',[m [31m- COMMENT_NODE_HIDDEN => 'hidden',[m [32m+[m[32m COMMENT_ENTITY_OPEN => 'open',[m [32m+[m[32m COMMENT_ENTITY_CLOSED => 'closed',[m [32m+[m[32m COMMENT_ENTITY_HIDDEN => 'hidden',[m );[m $verbose = $info;[m $verbose['form'] = $t_form[$info['form']];[m [1mdiff --git a/modules/node/node.install b/modules/node/node.install[m [1mindex 3f732a4..48cf50a 100644[m [1m--- a/modules/node/node.install[m [1m+++ b/modules/node/node.install[m [36m@@ -70,12 +70,6 @@[m [mfunction node_schema() {[m 'not null' => TRUE,[m 'default' => 0,[m ),[m [31m- 'comment' => array([m [31m- 'description' => 'Whether comments are allowed on this node: 0 = no, 1 = closed (read only), 2 = open (read/write).',[m [31m- 'type' => 'int',[m [31m- 'not null' => TRUE,[m [31m- 'default' => 0,[m [31m- ),[m 'promote' => array([m 'description' => 'Boolean indicating whether the node should be displayed on the front page.',[m 'type' => 'int',[m [36m@@ -234,12 +228,6 @@[m [mfunction node_schema() {[m 'not null' => TRUE,[m 'default' => 1,[m ),[m [31m- 'comment' => array([m [31m- 'description' => 'Whether comments are allowed on this node (at the time of this revision): 0 = no, 1 = closed (read only), 2 = open (read/write).',[m [31m- 'type' => 'int',[m [31m- 'not null' => TRUE,[m [31m- 'default' => 0,[m [31m- ),[m 'promote' => array([m 'description' => 'Boolean indicating whether the node (at the time of this revision) should be displayed on the front page.',[m 'type' => 'int',[m [1mdiff --git a/modules/node/node.module b/modules/node/node.module[m [1mindex 0c3cfb7..45b5ce0 100644[m [1m--- a/modules/node/node.module[m [1m+++ b/modules/node/node.module[m [36m@@ -172,6 +172,7 @@[m [mfunction node_entity_info() {[m 'revision table' => 'node_revision',[m 'uri callback' => 'node_uri',[m 'fieldable' => TRUE,[m [32m+[m[32m 'comment' => TRUE,[m 'entity keys' => array([m 'id' => 'nid',[m 'revision' => 'vid',[m [1mdiff --git a/themes/bartik/templates/comment-wrapper.tpl.php b/themes/bartik/templates/comment-wrapper.tpl.php[m [1mindex 864dc41..1a58a9a 100644[m [1m--- a/themes/bartik/templates/comment-wrapper.tpl.php[m [1m+++ b/themes/bartik/templates/comment-wrapper.tpl.php[m [36m@@ -36,7 +36,7 @@[m */[m ?>[m