Skip to content

Commit 1bbc8bd

Browse files
committed
Merge branch 'release/3.2.0'
2 parents fc563d3 + 1f151ec commit 1bbc8bd

File tree

95 files changed

+189
-23933
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

95 files changed

+189
-23933
lines changed

CHANGELOG.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
1+
# v3.2.0
2+
## 03/28/2022
3+
4+
1. [](#new)
5+
* Require **Grav 1.7.32** and **Form 6.0.0**
6+
1. [](#improved)
7+
* Added access email message object inside the twig template file
8+
2. [](#bugfix)
9+
* Fixed twig not being initialized when building an email message
10+
111
# v3.1.5
2-
## 01/03/22
12+
## 01/03/2022
313

414
1. [](#improved)
515
* Updated to Swiftmailer `v6.3.0` with PHP 8.1 compatibility [#157](https://github.com/getgrav/grav-plugin-email/issues/157)

blueprints.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: Email
22
slug: email
33
type: plugin
4-
version: 3.1.5
4+
version: 3.2.0
55
testing: false
66
description: Enables the emailing system for Grav
77
icon: envelope
@@ -15,8 +15,8 @@ bugs: https://github.com/getgrav/grav-plugin-email/issues
1515
license: MIT
1616

1717
dependencies:
18-
- { name: grav, version: '>=1.6.0' }
19-
- { name: form, version: '>=3.0.3' }
18+
- { name: grav, version: '>=1.7.32' }
19+
- { name: form, version: '>=6.0.0' }
2020

2121
form:
2222
validation: loose

classes/Email.php

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -136,13 +136,17 @@ public function buildMessage(array $params, array $vars = [])
136136
{
137137
/** @var Twig $twig */
138138
$twig = Grav::instance()['twig'];
139+
$twig->init();
139140

140141
/** @var Config $config */
141142
$config = Grav::instance()['config'];
142143

143144
/** @var Language $language */
144145
$language = Grav::instance()['language'];
145146

147+
// Create message object.
148+
$message = $this->message();
149+
146150
// Extend parameters with defaults.
147151
$params += [
148152
'bcc' => $config->get('plugins.email.bcc', []),
@@ -159,12 +163,10 @@ public function buildMessage(array $params, array $vars = [])
159163
'to' => $config->get('plugins.email.to'),
160164
'to_name' => $config->get('plugins.email.to_name'),
161165
'process_markdown' => false,
162-
'template' => false
166+
'template' => false,
167+
'message' => $message
163168
];
164169

165-
// Create message object.
166-
$message = $this->message();
167-
168170
if (!$params['to']) {
169171
throw new \RuntimeException($language->translate('PLUGIN_EMAIL.PLEASE_CONFIGURE_A_TO_ADDRESS'));
170172
}
@@ -233,7 +235,9 @@ public function buildMessage(array $params, array $vars = [])
233235
break;
234236

235237
case 'subject':
236-
$message->setSubject($twig->processString($language->translate($value), $vars));
238+
if ($value) {
239+
$message->setSubject($twig->processString($language->translate($value), $vars));
240+
}
237241
break;
238242

239243
case 'to':

composer.json

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,24 @@
2020
"docs": "https://github.com/getgrav/grav-plugin-email/blob/master/README.md"
2121
},
2222
"require": {
23-
"php": ">=7.1.3",
23+
"php": ">=7.3.6",
2424
"swiftmailer/swiftmailer": "~6.0"
2525
},
26+
"replace": {
27+
"symfony/polyfill-iconv": "*",
28+
"symfony/polyfill-mbstring": "*",
29+
"symfony/polyfill-php72": "*"
30+
},
2631
"autoload": {
2732
"psr-4": {
2833
"Grav\\Plugin\\Email\\": "classes/",
2934
"Grav\\Plugin\\Console\\": "cli/"
3035
},
3136
"classmap": ["email.php"]
37+
},
38+
"config": {
39+
"platform": {
40+
"php": "7.3.6"
41+
}
3242
}
3343
}

0 commit comments

Comments
 (0)