Skip to content

Commit

Permalink
Merge branch 'release/3.1.3'
Browse files Browse the repository at this point in the history
  • Loading branch information
rhukster committed Jul 19, 2021
2 parents df70efe + b68c142 commit 859a564
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 2 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
# v3.1.3
## 07/19/2021

1. [](#improved)
* Pass page variable to processed forms [#141](https://github.com/getgrav/grav-plugin-email/pull/141)
* Email configuration available to templates [#152](https://github.com/getgrav/grav-plugin-email/pull/152)
* New Event after eMail was sent [#151](https://github.com/getgrav/grav-plugin-email/pull/151)

# v3.1.2
## 04/06/2021

Expand Down
2 changes: 1 addition & 1 deletion blueprints.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Email
slug: email
type: plugin
version: 3.1.2
version: 3.1.3
testing: false
description: Enables the emailing system for Grav
icon: envelope
Expand Down
5 changes: 5 additions & 0 deletions classes/Email.php
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,11 @@ public function buildMessage(array $params, array $vars = [])
throw new \RuntimeException($language->translate('PLUGIN_EMAIL.PLEASE_CONFIGURE_A_FROM_ADDRESS'));
}

// make email configuration available to templates
$vars += [
'email' => $params,
];

// Process parameters.
foreach ($params as $key => $value) {
switch ($key) {
Expand Down
6 changes: 5 additions & 1 deletion email.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,8 @@ public function onFormProcessed(Event $event)
case 'email':
// Prepare Twig variables
$vars = array(
'form' => $form
'form' => $form,
'page' => $this->grav['page']
);

// Copy files now, we need those.
Expand Down Expand Up @@ -164,6 +165,9 @@ protected function sendFormEmail($form, $params, $vars)

// Send e-mail
$this->email->send($message);

//fire event after eMail was sent
$this->grav->fireEvent('onEmailSent', new Event(['message' => $message, 'params' => $params, 'form' => $form]));
}

protected function isAssocArray(array $arr)
Expand Down

0 comments on commit 859a564

Please sign in to comment.