Created
November 28, 2012 23:53
-
-
Save brabijan/4165652 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* @param Nette\Application\Application $app | |
* @param Nette\Application\PresenterRequest $request | |
* @return void | |
*/ | |
public static function setErrorPresenter($app, $request) { | |
$errorPresenter = 'Error'; | |
$modules = explode(":",$request->getPresenterName()); | |
unset($modules[count($modules)-1]); | |
while(count($modules)!=0) { | |
$catched = false; | |
try { | |
$errorPresenter = implode(":", $modules).':Error'; | |
$errorPresenterClass = $app->getPresenterFactory()->getPresenterClass($errorPresenter); | |
} | |
catch( Nette\Application\InvalidPresenterException $e ) { | |
$catched = true; | |
} | |
if(!$catched) break; | |
unset($modules[count($modules)-1]); | |
} | |
$app->errorPresenter = $errorPresenter; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment