O'Reilly logo

Drupal 8 Module Development by Daniel Sipos

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Entity access hooks

As I mentioned, the entity access handler invokes access hooks that modules that don't own the entity type can implement in order to have their say in the access to an entity. There are two sets of access hooks to speak of. The first set covers create operations, as follows:

  • hook_entity_create_access()
  • hook_[entity_type]_create_access()

The second set covers view, update, and delete operations:

  • hook_entity_access()
  • hook_[entity_type]_access()

For each set, we have two hooks invoked at the same time that go from generic to entity type specific. For example, when trying to view a node, the second hook that is invoked is hook_node_access().

The entity access hook implementations, as you remember from our earlier discussion, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required