Drupal 8 has adopted Symfony as a part of its core. It uses Symfony kernel and events to do the same now. The list of kernel events available in Drupal 8 is as follows:
- KernelEvents::CONTROLLER
 The CONTROLLER event occurs once a controller was found for handling a request.
 
- KernelEvents::EXCEPTION
 The EXCEPTION event occurs when an uncaught exception appears.
 
- KernelEvents::FINISH_REQUEST 
 The FINISH_REQUEST event occurs when a response was generated for a request.
 
- KernelEvents::REQUEST 
 The REQUEST event occurs at the very beginning of request dispatching.
 
- KernelEvents::RESPONSE
 The RESPONSE event occurs once a response was created for replying to a request.
 
- KernelEvents::TERMINATE
 The TERMINATE event occurs once a response was sent.
 
- KernelEvents::VIEW
 The VIEW event occurs when the return value of a controller is not a Response instance.
Drupal 8 provides a way to subscribe to all these events and attach callbacks to be executed when these events occur. If our module needs to perform changes on the request/response object very early to the request an event subscriber should be used listening to the KernelEvents::REQUEST event. The same goes for the other events as well.

 
 
 
 
No comments:
Post a Comment