Updated to Drupal 8.5. Core Media not yet in use.
[yaffs-website] / vendor / chi-teck / drupal-code-generator / templates / d7 / hook / node_search_result.twig
diff --git a/vendor/chi-teck/drupal-code-generator/templates/d7/hook/node_search_result.twig b/vendor/chi-teck/drupal-code-generator/templates/d7/hook/node_search_result.twig
new file mode 100644 (file)
index 0000000..9372dc1
--- /dev/null
@@ -0,0 +1,7 @@
+/**
+ * Implements hook_node_search_result().
+ */
+function {{ machine_name }}_node_search_result($node) {
+  $comments = db_query('SELECT comment_count FROM {node_comment_statistics} WHERE nid = :nid', array('nid' => $node->nid))->fetchField();
+  return array('comment' => format_plural($comments, '1 comment', '@count comments'));
+}