Updated to Drupal 8.5. Core Media not yet in use.
[yaffs-website] / vendor / chi-teck / drupal-code-generator / templates / d8 / hook / entity_field_access.twig
diff --git a/vendor/chi-teck/drupal-code-generator/templates/d8/hook/entity_field_access.twig b/vendor/chi-teck/drupal-code-generator/templates/d8/hook/entity_field_access.twig
new file mode 100644 (file)
index 0000000..6ea8d4a
--- /dev/null
@@ -0,0 +1,9 @@
+/**
+ * Implements hook_entity_field_access().
+ */
+function {{ machine_name }}_entity_field_access($operation, \Drupal\Core\Field\FieldDefinitionInterface $field_definition, \Drupal\Core\Session\AccountInterface $account, \Drupal\Core\Field\FieldItemListInterface $items = NULL) {
+  if ($field_definition->getName() == 'field_of_interest' && $operation == 'edit') {
+    return AccessResult::allowedIfHasPermission($account, 'update field of interest');
+  }
+  return AccessResult::neutral();
+}