Updated to Drupal 8.5. Core Media not yet in use.
[yaffs-website] / vendor / chi-teck / drupal-code-generator / templates / d8 / hook / node_update_index.twig
diff --git a/vendor/chi-teck/drupal-code-generator/templates/d8/hook/node_update_index.twig b/vendor/chi-teck/drupal-code-generator/templates/d8/hook/node_update_index.twig
new file mode 100644 (file)
index 0000000..4677448
--- /dev/null
@@ -0,0 +1,11 @@
+/**
+ * Implements hook_node_update_index().
+ */
+function {{ machine_name }}_node_update_index(\Drupal\node\NodeInterface $node) {
+  $text = '';
+  $ratings = db_query('SELECT title, description FROM {my_ratings} WHERE nid = :nid', [':nid' => $node->id()]);
+  foreach ($ratings as $rating) {
+    $text .= '<h2>' . Html::escape($rating->title) . '</h2>' . Xss::filter($rating->description);
+  }
+  return $text;
+}