Skip to content

Commit

Permalink
Merge pull request #5019 from burzum/bug/plugin-views
Browse files Browse the repository at this point in the history
Fixing the view file loading for plugins in View/View.php
  • Loading branch information
markstory committed Oct 31, 2014
2 parents d4eaf22 + 5f92bd8 commit 6005634
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/View/View.php
Original file line number Diff line number Diff line change
Expand Up @@ -815,8 +815,9 @@ protected function _getViewFileName($name = null) {
if ($name === null) {
$name = $this->view;
}
$name = str_replace('/', DS, $name);

list($plugin, $name) = $this->pluginSplit($name);
$name = str_replace('/', DS, $name);

if (strpos($name, DS) === false && $name[0] !== '.') {
$name = $this->viewPath . DS . $subDir . Inflector::underscore($name);
Expand Down
5 changes: 5 additions & 0 deletions tests/TestCase/View/ViewTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,11 @@ public function testGetTemplate() {
$request->action = 'display';
$request->params['pass'] = array('home');

$ThemeView = new TestView(null, null, null, $viewOptions);
$expected = TEST_APP . 'Plugin' . DS . 'Company' . DS . 'TestPluginThree' . DS . 'src' . DS . 'Template' . DS . 'Pages' . DS . 'index.ctp';
$result = $ThemeView->getViewFileName('Company/TestPluginThree./Pages/index');
$this->assertPathEquals($expected, $result);

$ThemeView = new TestView(null, null, null, $viewOptions);
$ThemeView->theme = 'TestTheme';
$expected = TEST_APP . 'TestApp' . DS . 'Template' . DS . 'Pages' . DS . 'home.ctp';
Expand Down
Empty file.

0 comments on commit 6005634

Please sign in to comment.