Skip to content

Commit

Permalink
Merge pull request #837 from phalcon/3.2.x
Browse files Browse the repository at this point in the history
3.2.5
  • Loading branch information
sergeyklay authored Oct 23, 2017
2 parents f8595b4 + 042d525 commit 3362a50
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 10 deletions.
36 changes: 26 additions & 10 deletions Library/Phalcon/Mailer/Manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,15 @@
/**
* Class Manager
*
* *<code>
* $mailer = \Phalcon\Mailer\Manager($config);
*
* if need to set view engines
* $mailer->setViewEngines([
* '.phtml' => 'Phalcon\Mvc\View\Engine\Php'
* ]);
*</code>
*
* @package Phalcon\Manager
*/
class Manager extends Component
Expand All @@ -50,6 +59,11 @@ class Manager extends Component
*/
protected $view;

/**
* @var array
*/
protected $viewEngines = null;

/**
* Create a new MailerManager component using $config for configuring
*
Expand Down Expand Up @@ -145,6 +159,16 @@ public function normalizeEmail($email)
}
}

/**
* set value of $viewEngines
*
* @param array $engines
*/
public function setViewEngines(array $engines)
{
$this->viewEngines = $engines;
}

/**
* Configure MailerManager class
*
Expand Down Expand Up @@ -338,16 +362,8 @@ protected function getView()
$view = $this->getDI()->get('\Phalcon\Mvc\View\Simple');
$view->setViewsDir($viewsDir);

if ($registeredEngines = $viewApp->getRegisteredEngines()) {
$engines = [];
foreach ($registeredEngines as $key => $engine) {
if (is_object($engine)) {
$engines[$key] = get_class($engine);
} else {
$engines[$key] = $engine;
}
}
$view->registerEngines($engines);
if ($this->viewEngines) {
$view->registerEngines($this->viewEngines);
}

$this->view = $view;
Expand Down

0 comments on commit 3362a50

Please sign in to comment.