I'm using Field Permissions module to restrict access to each field.

If you choose custom permission on /admin/structure/types/manage/CONTENT_TYPE/fields/FIELD_NAME, you'll see these permissions are available:

  • Enter own value for field [FIELD_NAME]
  • Edit own value for field [FIELD_NAME]
  • Edit any value for field [FIELD_NAME]
  • View own value for field [FIELD_NAME]
  • View any value for field [FIELD_NAME]

I would like to add some permissions with extra conditions like 'Edit any value for field [FIELD_NAME] if the field is empty'.

For D7 version of the module there was a hook called hook_field_permissions_list_alter but there's no such thing in D8 version.

Is there any way to modify the list?

1 Answer 1


With Drupal 8, the module implemented the permission type plugins. To add more permissions, you implement a new permission type plugin, using one of the existing plugin classes as example, such as Drupal\field_permissions\Plugin\FieldPermissionType\CustomAccess or Drupal\field_permissions\Plugin\FieldPermissionType\PrivateAccess. Drupal\field_permissions\Plugin\FieldPermissionType\Base is used as base class, and simplifies the creation of new permission type plugins.

Note that the module invokes the hook_field_permission_type_plugin_alter() implementations, as described in the field_permissions.api.php file. That hook can just be used to remove a permission type plugin, or change the plugin properties given in its annotation (which doesn't include the permissions exposed from the plugin, for what I can see).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.