Updated to Drupal 8.5. Core Media not yet in use.
[yaffs-website] / vendor / chi-teck / drupal-code-generator / templates / d8 / hook / node_grants.twig
diff --git a/vendor/chi-teck/drupal-code-generator/templates/d8/hook/node_grants.twig b/vendor/chi-teck/drupal-code-generator/templates/d8/hook/node_grants.twig
new file mode 100644 (file)
index 0000000..fc68293
--- /dev/null
@@ -0,0 +1,12 @@
+/**
+ * Implements hook_node_grants().
+ */
+function {{ machine_name }}_node_grants(\Drupal\Core\Session\AccountInterface $account, $op) {
+  if ($account->hasPermission('access private content')) {
+    $grants['example'] = [1];
+  }
+  if ($account->id()) {
+    $grants['example_author'] = [$account->id()];
+  }
+  return $grants;
+}