Add class_exists() check for view class.

Check that the view class hasn't already been mapped in the autoloader
before mapping it. This allows developers to map view classes from
plugins.

Fixes #2684
This commit is contained in:
mark_story 2012-03-14 20:56:59 -04:00
parent 3e0294a695
commit f1931e43ef

View file

@ -581,9 +581,11 @@ class RequestHandlerComponent extends Component {
$controller->ext = '.ctp';
$viewClass = Inflector::classify($type);
App::uses($viewClass . 'View', 'View');
if (class_exists($viewClass . 'View')) {
$viewName = $viewClass . 'View';
if (!class_exists($viewName)) {
App::uses($viewName, 'View');
}
if (class_exists($viewName)) {
$controller->viewClass = $viewClass;
} elseif (empty($this->_renderType)) {
$controller->viewPath .= DS . $type;