CakePHP View Events - CakePHP

What are CakePHP View Events?

There are several callbacks/events that we can use with View events. these occasions are useful to carry out several responsibilities before some thing occurs or after some thing happens. the subsequent is a list of callbacks that can be used with CakePHP.


Event function & Description


Helper::beforeRender(event $event, $viewFile)

ThebeforeRendermethod is called after the controller’s beforeRender technique however before the controller rendersviewandlayout.This receives the record being rendered as an issue.


Helper::beforeRenderFile(occasion $occasion, $viewFile)

This method is called earlier than each view file is rendered. This includesfactors, perspectives, discern viewsandlayouts.


Helper::afterRenderFile(occasion $occasion, $viewFile, $content material)

This approach is called after each View report is rendered. This consists of elements,views,parent viewsandlayouts. A callback can adjust and return$contentto alternate how the rendered content can be displayed inside the browser.


Helper::afterRender(occasion $occasion, $viewFile)

This method is referred to as after the view has been rendered but before the format rendering has commenced.


Helper::beforeLayout(occasion $event, $layoutFile)

This method is referred to as before the format rendering starts. This gets the layout filename as an issue.


Helper::afterLayout(event $event, $layoutFile)

This approach is called after the format rendering is whole. This receives the layout filename as an argument.

All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd Protection Status

CakePHP Topics