function _socialbase_node_get_comment_count in Open Social 8.2
Same name and namespace in other branches
- 8.9 themes/socialbase/socialbase.theme \_socialbase_node_get_comment_count()
- 8 themes/socialbase/socialbase.theme \_socialbase_node_get_comment_count()
- 8.3 themes/socialbase/socialbase.theme \_socialbase_node_get_comment_count()
- 8.4 themes/socialbase/socialbase.theme \_socialbase_node_get_comment_count()
- 8.5 themes/socialbase/socialbase.theme \_socialbase_node_get_comment_count()
- 8.6 themes/socialbase/socialbase.theme \_socialbase_node_get_comment_count()
- 8.7 themes/socialbase/socialbase.theme \_socialbase_node_get_comment_count()
- 8.8 themes/socialbase/socialbase.theme \_socialbase_node_get_comment_count()
Get comment count for a node.
1 call to _socialbase_node_get_comment_count()
- Node::preprocessElement in themes/
socialbase/ src/ Plugin/ Preprocess/ Node.php - Preprocess the variables array if an element is present.
File
- themes/
socialbase/ socialbase.theme, line 83 - The primary PHP file for the Social base theme.
Code
function _socialbase_node_get_comment_count(Node $node, $comment_field_name) {
$count = 0;
$comment_count = $node->{$comment_field_name}->comment_count;
if ($comment_count) {
$count = $comment_count;
}
return $count;
}