merge master in prod
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
<?php
|
||||
namespace Grav\Plugin;
|
||||
|
||||
use Grav\Common\Data\Data;
|
||||
use Grav\Common\Plugin;
|
||||
use Grav\Plugin\Email\Email;
|
||||
use RocketTheme\Toolbox\Event\Event;
|
||||
@@ -22,6 +23,7 @@ class EmailPlugin extends Plugin
|
||||
'onFormProcessed' => ['onFormProcessed', 0],
|
||||
'onTwigTemplatePaths' => ['onTwigTemplatePaths', 0],
|
||||
'onSchedulerInitialized' => ['onSchedulerInitialized', 0],
|
||||
'onAdminSave' => ['onAdminSave', 0],
|
||||
];
|
||||
}
|
||||
|
||||
@@ -48,6 +50,28 @@ class EmailPlugin extends Plugin
|
||||
$twig->twig_paths[] = __DIR__ . '/templates';
|
||||
}
|
||||
|
||||
/**
|
||||
* Force compile during save if admin plugin save
|
||||
*
|
||||
* @param Event $event
|
||||
*/
|
||||
public function onAdminSave(Event $event)
|
||||
{
|
||||
/** @var Data $obj */
|
||||
$obj = $event['object'];
|
||||
|
||||
|
||||
|
||||
if ($obj instanceof Data && $obj->blueprints()->getFilename() === 'email/blueprints') {
|
||||
$current_pw = $this->grav['config']->get('plugins.email.mailer.smtp.password');
|
||||
$new_pw = $obj->get('mailer.smtp.password');
|
||||
if (!empty($current_pw) && empty($new_pw)) {
|
||||
$obj->set('mailer.smtp.password', $current_pw);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Send email when processing the form data.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user