Themed CakeEmail should load view helpers with the theme set

This commit is contained in:
Hadrien 2014-03-18 14:22:24 +01:00
parent d559e429e6
commit d55a167830
3 changed files with 8 additions and 3 deletions

View file

@ -1623,6 +1623,11 @@ class CakeEmail {
$View = new $viewClass(null);
$View->viewVars = $this->_viewVars;
$View->helpers = $this->_helpers;
if ($this->_theme) {
$View->theme = $this->_theme;
}
$View->loadHelpers();
list($templatePlugin, $template) = pluginSplit($this->_template);
@ -1632,9 +1637,7 @@ class CakeEmail {
} elseif ($layoutPlugin) {
$View->plugin = $layoutPlugin;
}
if ($this->_theme) {
$View->theme = $this->_theme;
}
// Convert null to false, as View needs false to disable
// the layout.
if ($layout === null) {

View file

@ -1337,6 +1337,7 @@ class CakeEmailTest extends CakeTestCase {
$this->assertContains('In TestTheme', $result['message']);
$this->assertContains('Message-ID: ', $result['headers']);
$this->assertContains('To: ', $result['headers']);
$this->assertContains('/theme/TestTheme/img/test.jpg', $result['message']);
}
/**

View file

@ -1 +1,2 @@
In TestTheme
<?php echo $this->Html->image('test.jpg') ?>