March 2019
Intermediate to advanced
580 pages
15h 3m
English
One of the powers of using the access handler is that we can make it aware of the service container and inject whatever services we might need to determine access. However, it's not immediately clear how you can do this, so we'll break it down here.
The first thing we will need is to have our access handler implement the \Drupal\core\Entity\EntityHandlerInterface. Note that this applies in the same way to the other types of handlers, not just access-related. This interface has one method, which will receive the container and the entity type definition: createInstance().
Knowing this, the rest is very similar to how we injected services into Controllers and Forms using the create() method, which only ...
Read now
Unlock full access