Added registerMailLayouts method to PluginBase (#3850)

Fixes #3820. Credit to @tobias-kuendig
This commit is contained in:
Tobias Kündig 2018-10-08 16:18:43 +02:00 committed by Luke Towers
parent 0415e4133d
commit 7b4e293074
2 changed files with 21 additions and 0 deletions

View File

@ -340,6 +340,11 @@ class MailManager
$plugins = PluginManager::instance()->getPlugins(); $plugins = PluginManager::instance()->getPlugins();
foreach ($plugins as $pluginId => $pluginObj) { foreach ($plugins as $pluginId => $pluginObj) {
$layouts = $pluginObj->registerMailLayouts();
if (is_array($layouts)) {
$this->registerMailLayouts($layouts);
}
$templates = $pluginObj->registerMailTemplates(); $templates = $pluginObj->registerMailTemplates();
if (is_array($templates)) { if (is_array($templates)) {
$this->registerMailTemplates($templates); $this->registerMailTemplates($templates);

View File

@ -202,6 +202,22 @@ class PluginBase extends ServiceProviderBase
return []; return [];
} }
/**
* Registers any mail layouts implemented by this plugin.
* The layouts must be returned in the following format:
*
* return [
* 'marketing' => 'acme.blog::layouts.marketing',
* 'notification' => 'acme.blog::layouts.notification',
* ];
*
* @return array
*/
public function registerMailLayouts()
{
return [];
}
/** /**
* Registers any mail templates implemented by this plugin. * Registers any mail templates implemented by this plugin.
* The templates must be returned in the following format: * The templates must be returned in the following format: