Upgrade to 3.2.0
This commit is contained in:
@@ -3,13 +3,18 @@
|
||||
namespace Kirby\Cms;
|
||||
|
||||
use Kirby\Exception\NotFoundException;
|
||||
use Kirby\Toolkit\Tpl;
|
||||
|
||||
/**
|
||||
* Wrapper around our PHPMailer package, which
|
||||
* handles all the magic connections between Kirby
|
||||
* and sending emails, like email templates, file
|
||||
* attachments, etc.
|
||||
*
|
||||
* @package Kirby Cms
|
||||
* @author Bastian Allgeier <bastian@getkirby.com>
|
||||
* @link https://getkirby.com
|
||||
* @copyright Bastian Allgeier GmbH
|
||||
* @license https://getkirby.com/license
|
||||
*/
|
||||
class Email
|
||||
{
|
||||
@@ -28,7 +33,7 @@ class Email
|
||||
|
||||
public function __construct($preset = [], array $props = [])
|
||||
{
|
||||
$this->options = $options = App::instance()->option('email');
|
||||
$this->options = App::instance()->option('email');
|
||||
|
||||
// load presets from options
|
||||
$this->preset = $this->preset($preset);
|
||||
@@ -46,7 +51,11 @@ class Email
|
||||
$this->template();
|
||||
}
|
||||
|
||||
protected function preset($preset)
|
||||
/**
|
||||
* @param string|array $preset
|
||||
* @return array
|
||||
*/
|
||||
protected function preset($preset): array
|
||||
{
|
||||
// only passed props, not preset name
|
||||
if (is_string($preset) !== true) {
|
||||
@@ -64,7 +73,7 @@ class Email
|
||||
return $this->options['presets'][$preset];
|
||||
}
|
||||
|
||||
protected function template()
|
||||
protected function template(): void
|
||||
{
|
||||
if (isset($this->props['template']) === true) {
|
||||
|
||||
@@ -93,6 +102,13 @@ class Email
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Undocumented function
|
||||
*
|
||||
* @param string $name
|
||||
* @param string|null $type
|
||||
* @return Kirby\Cms\Template
|
||||
*/
|
||||
protected function getTemplate(string $name, string $type = null)
|
||||
{
|
||||
return App::instance()->template('emails/' . $name, $type, 'text');
|
||||
@@ -130,7 +146,7 @@ class Email
|
||||
}
|
||||
}
|
||||
|
||||
protected function transformProp($prop, $model)
|
||||
protected function transformProp(string $prop, string $model): void
|
||||
{
|
||||
if (isset($this->props[$prop]) === true) {
|
||||
$this->props[$prop] = $this->{'transform' . ucfirst($model)}($this->props[$prop]);
|
||||
|
Reference in New Issue
Block a user