Loading socialbase.theme +3 −0 Original line number Diff line number Diff line Loading @@ -109,6 +109,9 @@ function _socialbase_get_join_method_icon($title) { /** * Get comment count for a node. * * @deprecated * Use $entity->get(<comment_field_name>)->comment_count instead this function. */ function _socialbase_node_get_comment_count(NodeInterface $node) { $comment_count = &drupal_static(__FUNCTION__ . $node->id()); Loading src/Plugin/Preprocess/Field.php +1 −1 Original line number Diff line number Diff line Loading @@ -70,7 +70,7 @@ class Field extends PreprocessBase { $node = !empty($attached['#object']) ? $attached['#object'] : NULL; // Count the amount of comments placed on a Node.. if ($node instanceof Node) { $comment_count = _socialbase_node_get_comment_count($node); $comment_count = (int) $node->get($element['#field_name'])->comment_count; // Add it to the title. $variables['comment_count'] = $comment_count; Loading src/Plugin/Preprocess/Node.php +1 −1 Original line number Diff line number Diff line Loading @@ -173,7 +173,7 @@ class Node extends PreprocessBase { // OPEN or CLOSED we can render icon for // comment count, and add the comment count to the node. if ($node->$comment_field_name->status != CommentItemInterface::HIDDEN) { $comment_count = _socialbase_node_get_comment_count($node); $comment_count = (int) $node->get($comment_field_name)->comment_count; $variables['below_content'][$comment_field_name]['#title'] = $comment_count === 0 ? t('Be the first one to comment') : t('Comments'); // If it's closed, we only show the comment section when there are Loading Loading
socialbase.theme +3 −0 Original line number Diff line number Diff line Loading @@ -109,6 +109,9 @@ function _socialbase_get_join_method_icon($title) { /** * Get comment count for a node. * * @deprecated * Use $entity->get(<comment_field_name>)->comment_count instead this function. */ function _socialbase_node_get_comment_count(NodeInterface $node) { $comment_count = &drupal_static(__FUNCTION__ . $node->id()); Loading
src/Plugin/Preprocess/Field.php +1 −1 Original line number Diff line number Diff line Loading @@ -70,7 +70,7 @@ class Field extends PreprocessBase { $node = !empty($attached['#object']) ? $attached['#object'] : NULL; // Count the amount of comments placed on a Node.. if ($node instanceof Node) { $comment_count = _socialbase_node_get_comment_count($node); $comment_count = (int) $node->get($element['#field_name'])->comment_count; // Add it to the title. $variables['comment_count'] = $comment_count; Loading
src/Plugin/Preprocess/Node.php +1 −1 Original line number Diff line number Diff line Loading @@ -173,7 +173,7 @@ class Node extends PreprocessBase { // OPEN or CLOSED we can render icon for // comment count, and add the comment count to the node. if ($node->$comment_field_name->status != CommentItemInterface::HIDDEN) { $comment_count = _socialbase_node_get_comment_count($node); $comment_count = (int) $node->get($comment_field_name)->comment_count; $variables['below_content'][$comment_field_name]['#title'] = $comment_count === 0 ? t('Be the first one to comment') : t('Comments'); // If it's closed, we only show the comment section when there are Loading