diff --git a/src/View/View.php b/src/View/View.php index d91e89356cb..cf5f569aa7f 100644 --- a/src/View/View.php +++ b/src/View/View.php @@ -852,6 +852,8 @@ protected function _getViewFileName($name = null) { $name = trim($name, DS); } elseif (!$plugin || $this->viewPath !== $this->name) { $name = $this->viewPath . DS . $subDir . $name; + } else { + $name = DS . $subDir . $name; } } diff --git a/tests/TestCase/View/CellTest.php b/tests/TestCase/View/CellTest.php index e49f586ecc4..7a00a2434f2 100644 --- a/tests/TestCase/View/CellTest.php +++ b/tests/TestCase/View/CellTest.php @@ -157,6 +157,17 @@ public function testPluginCell() { $this->assertContains('hello world!', "{$cell}"); } +/** + * Test that plugin cells can render other view templates. + * + * @return void + */ + public function testPluginCellAlternateTemplate() { + $cell = $this->View->cell('TestPlugin.Dummy::echoThis', ['msg' => 'hello world!']); + $cell->template = '../../Element/translate'; + $this->assertContains('This is a translatable string', "{$cell}"); + } + /** * Tests that using an unexisting cell throws an exception. *