Skip to content

Commit

Permalink
Ensure helpers are loaded in data views.
Browse files Browse the repository at this point in the history
Both XmlView and JsonView should load helpers when
they use view files.

Fixes #2465
  • Loading branch information
markstory committed Jan 12, 2012
1 parent 7877e7f commit 0f8e150
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/Cake/View/JsonView.php
Expand Up @@ -96,6 +96,9 @@ public function render($view = null, $layout = null) {
return $content; return $content;
} }
if ($view !== false && $viewFileName = $this->_getViewFileName($view)) { if ($view !== false && $viewFileName = $this->_getViewFileName($view)) {
if (!$this->_helpersLoaded) {
$this->loadHelpers();
}
$content = $this->_render($viewFileName); $content = $this->_render($viewFileName);
$this->Blocks->set('content', $content); $this->Blocks->set('content', $content);
return $content; return $content;
Expand Down
3 changes: 3 additions & 0 deletions lib/Cake/View/XmlView.php
Expand Up @@ -99,6 +99,9 @@ public function render($view = null, $layout = null) {
return $content; return $content;
} }
if ($view !== false && $viewFileName = $this->_getViewFileName($view)) { if ($view !== false && $viewFileName = $this->_getViewFileName($view)) {
if (!$this->_helpersLoaded) {
$this->loadHelpers();
}
$content = $this->_render($viewFileName); $content = $this->_render($viewFileName);
$this->Blocks->set('content', (string)$content); $this->Blocks->set('content', (string)$content);
return $content; return $content;
Expand Down

0 comments on commit 0f8e150

Please sign in to comment.