Commit e4299afa by Qiang Xue

minor code refacotring.

parent 9fe0eb6c
...@@ -259,16 +259,16 @@ class View extends Component ...@@ -259,16 +259,16 @@ class View extends Component
$output = ''; $output = '';
if ($this->beforeRender($viewFile)) { if ($this->beforeRender($viewFile)) {
Yii::trace("Rendering view file: $viewFile", __METHOD__);
$ext = pathinfo($viewFile, PATHINFO_EXTENSION); $ext = pathinfo($viewFile, PATHINFO_EXTENSION);
if (isset($this->renderers[$ext])) { if (isset($this->renderers[$ext])) {
if (is_array($this->renderers[$ext])) { if (is_array($this->renderers[$ext]) || is_string($this->renders[$ext])) {
$this->renderers[$ext] = Yii::createObject($this->renderers[$ext]); $this->renderers[$ext] = Yii::createObject($this->renderers[$ext]);
} }
/** @var ViewRenderer $renderer */ /** @var ViewRenderer $renderer */
$renderer = $this->renderers[$ext]; $renderer = $this->renderers[$ext];
$output = $renderer->render($this, $viewFile, $params); $output = $renderer->render($this, $viewFile, $params);
} else { } else {
Yii::trace("Rendering view file: $viewFile", __METHOD__);
$output = $this->renderPhpFile($viewFile, $params); $output = $this->renderPhpFile($viewFile, $params);
} }
$this->afterRender($viewFile, $output); $this->afterRender($viewFile, $output);
......
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