commit 2abc042644273f54e4a110d75b256e6f1d49a727 Author: Andy Postnikov Date: Tue Feb 19 03:11:48 2013 +0400 Remove support for comments from views row plugin diff --git a/core/modules/node/lib/Drupal/node/Plugin/views/row/NodeRow.php b/core/modules/node/lib/Drupal/node/Plugin/views/row/NodeRow.php index e096fc2..eab28be 100644 --- a/core/modules/node/lib/Drupal/node/Plugin/views/row/NodeRow.php +++ b/core/modules/node/lib/Drupal/node/Plugin/views/row/NodeRow.php @@ -40,7 +40,6 @@ protected function defineOptions() { $options['view_mode']['default'] = 'teaser'; $options['links'] = array('default' => TRUE, 'bool' => TRUE); - $options['comments'] = array('default' => FALSE, 'bool' => TRUE); return $options; } @@ -56,11 +55,6 @@ public function buildOptionsForm(&$form, &$form_state) { '#title' => t('Display links'), '#default_value' => $this->options['links'], ); - $form['comments'] = array( - '#type' => 'checkbox', - '#title' => t('Display comments'), - '#default_value' => $this->options['comments'], - ); } } diff --git a/core/modules/node/lib/Drupal/node/Plugin/views/wizard/Node.php b/core/modules/node/lib/Drupal/node/Plugin/views/wizard/Node.php index a7f4f88..4d98c64 100644 --- a/core/modules/node/lib/Drupal/node/Plugin/views/wizard/Node.php +++ b/core/modules/node/lib/Drupal/node/Plugin/views/wizard/Node.php @@ -116,16 +116,6 @@ protected function build_form_style(array &$form, array &$form_state, $type) { ), '#default_value' => 1, ); - $style_form['row_options']['comments'] = array( - '#type' => 'select', - '#title_display' => 'invisible', - '#title' => t('Should comments be displayed below each node'), - '#options' => array( - 1 => t('with comments'), - 0 => t('without comments'), - ), - '#default_value' => 0, - ); break; } } @@ -222,13 +212,11 @@ protected function display_options_row(&$display_options, $row_plugin, $row_opt $display_options['row']['type'] = 'node'; $display_options['row']['options']['build_mode'] = 'full'; $display_options['row']['options']['links'] = !empty($row_options['links']); - $display_options['row']['options']['comments'] = !empty($row_options['comments']); break; case 'teasers': $display_options['row']['type'] = 'node'; $display_options['row']['options']['build_mode'] = 'teaser'; $display_options['row']['options']['links'] = !empty($row_options['links']); - $display_options['row']['options']['comments'] = !empty($row_options['comments']); break; case 'titles_linked': $display_options['row']['type'] = 'fields'; diff --git a/core/modules/node/node.views.inc b/core/modules/node/node.views.inc index cd6575e..1acfce7 100644 --- a/core/modules/node/node.views.inc +++ b/core/modules/node/node.views.inc @@ -660,10 +660,6 @@ function node_row_node_view_preprocess_node(&$vars) { if (!$options['links']) { unset($vars['content']['links']); } - - if (!empty($options['comments']) && user_access('access comments') && $node->comment) { - $vars['content']['comments'] = comment_node_page_additions($node); - } } /** diff --git a/core/modules/comment/lib/Drupal/comment/Plugin/field/widget/CommentWidget.php b/core/modules/comment/lib/Drupal/comment/Plugin/field/widget/CommentWidget.php index 6288ffc..26d3667 100644 --- a/core/modules/comment/lib/Drupal/comment/Plugin/field/widget/CommentWidget.php +++ b/core/modules/comment/lib/Drupal/comment/Plugin/field/widget/CommentWidget.php @@ -67,7 +67,7 @@ public function formElement(array $items, $delta, array $element, $langcode, arr '#type' => 'details', '#group' => 'advanced', '#attributes' => array( - 'class' => array('comment-' . $element['#entity_type'] . '-settings-form'), + 'class' => array('comment-' . drupal_html_class($element['#entity_type']) . '-settings-form'), ), '#attached' => array( 'library' => array('comment', 'drupal.comment'), diff --git a/core/modules/node/node.module b/core/modules/node/node.module index ad79f6d..f33e875 100644 --- a/core/modules/node/node.module +++ b/core/modules/node/node.module @@ -1159,7 +1159,7 @@ function template_preprocess_node(&$variables) { // @todo: The comment properties only exist if comment.module is enabled, but // are documented in node.tpl.php, so we make sure that they are set. // Consider removing them. - $properties = array('type', 'comment_count', 'uid', 'created', 'promote', 'sticky', 'status', 'comment'); + $properties = array('type', 'uid', 'created', 'promote', 'sticky', 'status'); foreach ($properties as $property) { $variables[$property] = isset($node->$property) ? $node->$property : NULL; } diff --git a/core/modules/node/templates/node.html.twig b/core/modules/node/templates/node.html.twig index f1e0b5a..f6054b1 100644 --- a/core/modules/node/templates/node.html.twig +++ b/core/modules/node/templates/node.html.twig @@ -40,7 +40,6 @@ * Other variables: * - node: Fully loaded node entity. * - type: Node type; for example, page, article, etc. - * - comment_count: Number of comments attached to the node. * - uid: User ID of the node author. * - created: Time the node was published formatted as a Unix timestamp. * - zebra: Outputs either "even" or "odd". Useful for zebra striping in @@ -54,7 +53,6 @@ * - promote: Flag for front page promotion state. * - sticky: Flag for sticky post setting. * - status: Flag for published status. - * - comment: State of comment settings for the node. * - readmore: Flag for more state. Will be true if the teaser content of the * node cannot hold the main body content. * - is_front: Flag for front. Will be true when presented on the front page. @@ -95,12 +93,10 @@
{# We hide the comments and links now so that we can render them later. #} - {% hide(content.comments) %} {% hide(content.links) %} {{ content }}
{{ content.links }} - {{ content.comments }} diff --git a/core/modules/node/templates/node.tpl.php b/core/modules/node/templates/node.tpl.php index 196d26f..588c881 100644 --- a/core/modules/node/templates/node.tpl.php +++ b/core/modules/node/templates/node.tpl.php @@ -43,7 +43,6 @@ * Other variables: * - $node: Full node entity. Contains data that may not be safe. * - $type: Node type; for example, page, article, etc. - * - $comment_count: Number of comments attached to the node. * - $uid: User ID of the node author. * - $created: Time the node was published formatted in Unix timestamp. * - $zebra: Outputs either "even" or "odd". Useful for zebra striping in @@ -57,7 +56,6 @@ * - $promote: Flag for front page promotion state. * - $sticky: Flags for sticky post setting. * - $status: Flag for published status. - * - $comment: State of comment settings for the node. * - $is_front: Flags true when presented in the front page. * - $logged_in: Flags true when the current user is a logged-in member. * - $is_admin: Flags true when the current user is an administrator. @@ -94,13 +92,11 @@
>
-