Commit 0cce7684 by Alexander Makarov

Removed ViewAction::afterRun()

parent 9fd0dced
...@@ -55,11 +55,6 @@ class ViewAction extends Action ...@@ -55,11 +55,6 @@ class ViewAction extends Action
public $layout; public $layout;
/** /**
* @var string Used to store controller layout during executin and then restore it
*/
private $_controllerLayout;
/**
* Runs the action. * Runs the action.
* This method displays the view requested by the user. * This method displays the view requested by the user.
* @throws NotFoundHttpException if the view file cannot be found * @throws NotFoundHttpException if the view file cannot be found
...@@ -68,13 +63,14 @@ class ViewAction extends Action ...@@ -68,13 +63,14 @@ class ViewAction extends Action
{ {
$viewPath = $this->getViewPath(); $viewPath = $this->getViewPath();
$controllerLayout = null;
if($this->layout !== null) { if($this->layout !== null) {
$this->_controllerLayout = $this->controller->layout; $controllerLayout = $this->controller->layout;
$this->controller->layout = $this->layout; $this->controller->layout = $this->layout;
} }
try { try {
return $this->render($viewPath); $output = $this->render($viewPath);
} catch (InvalidParamException $e) { } catch (InvalidParamException $e) {
if (YII_DEBUG) { if (YII_DEBUG) {
throw new NotFoundHttpException($e->getMessage()); throw new NotFoundHttpException($e->getMessage());
...@@ -84,6 +80,12 @@ class ViewAction extends Action ...@@ -84,6 +80,12 @@ class ViewAction extends Action
); );
} }
} }
if ($controllerLayout) {
$this->controller->layout = $controllerLayout;
}
return $output;
} }
/** /**
...@@ -98,17 +100,6 @@ class ViewAction extends Action ...@@ -98,17 +100,6 @@ class ViewAction extends Action
} }
/** /**
* @inheritdoc
*/
protected function afterRun()
{
if ($this->layout !== null) {
$this->controller->layout = $this->_controllerLayout;
}
parent::afterRun();
}
/**
* Obtain view path from GET * Obtain view path from GET
* *
* @return string view path * @return string view path
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment