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.

S.No

Event function & Description

1.

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.

2.

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

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

3.

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.

4.

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

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

5.

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

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

6.

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 DMCA.com Protection Status

CakePHP Topics