Skip to content

Commit

Permalink
Prevent RequestHandler to overwrite set view classes.
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark Scherer committed Sep 25, 2015
1 parent 9c3f728 commit 7d10fb5
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/Controller/Component/RequestHandlerComponent.php
Expand Up @@ -164,8 +164,8 @@ protected function _setExtension($request, $response)
} }


$accepts = $response->mapType($accept); $accepts = $response->mapType($accept);
$preferedTypes = current($accepts); $preferredTypes = current($accepts);
if (array_intersect($preferedTypes, ['html', 'xhtml'])) { if (array_intersect($preferredTypes, ['html', 'xhtml'])) {
return; return;
} }


Expand Down Expand Up @@ -546,7 +546,11 @@ public function renderAs(Controller $controller, $type, array $options = [])
} else { } else {
$view = Inflector::classify($type); $view = Inflector::classify($type);
} }
$viewClass = App::className($view, 'View', 'View');
$viewClass = null;
if ($builder->className() === null) {
$viewClass = App::className($view, 'View', 'View');
}


if ($viewClass) { if ($viewClass) {
$controller->viewClass = $viewClass; $controller->viewClass = $viewClass;
Expand Down

0 comments on commit 7d10fb5

Please sign in to comment.