Adding new callbacks into View.

This commit is contained in:
mark_story 2011-10-08 14:47:25 -04:00
parent 3fe79564b5
commit c49e261eba
2 changed files with 13 additions and 2 deletions

View file

@ -586,11 +586,19 @@ class ViewTest extends CakeTestCase {
$View->Helpers->expects($this->at(0))->method('trigger')
->with('beforeRender', $this->anything());
$View->Helpers->expects($this->at(1))->method('trigger')
->with('beforeRenderFile', $this->anything());
$View->Helpers->expects($this->at(2))->method('trigger')
->with('afterRenderFile', $this->anything());
$View->Helpers->expects($this->at(3))->method('trigger')
->with('afterRender', $this->anything());
$View->Helpers->expects($this->at(2))->method('trigger')
$View->Helpers->expects($this->at(4))->method('trigger')
->with('beforeLayout', $this->anything());
$View->Helpers->expects($this->at(3))->method('trigger')
$View->Helpers->expects($this->at(5))->method('trigger')
->with('beforeRenderFile', $this->anything());
$View->Helpers->expects($this->at(6))->method('trigger')
->with('afterRenderFile', $this->anything());
$View->Helpers->expects($this->at(7))->method('trigger')
->with('afterLayout', $this->anything());
$View->render('index');

View file

@ -754,7 +754,10 @@ class View extends Object {
$data = $this->viewVars;
}
$this->_current = $viewFile;
$this->Helpers->trigger('beforeRenderFile', array($viewFile));
$content = $this->_evaluate($viewFile, $data);
$this->Helpers->trigger('afterRenderFile', array($viewFile));
if (isset($this->_parents[$viewFile])) {
$this->_stack[] = $this->fetch('content');