LeKoala\EmailTemplates\Models\EmailTemplate
User defined email templates
Content of the template should override default content provided with setHTMLTemplate
For example, in the framework we have
$email = Email::create()->setHTMLTemplate('SilverStripe\\Control\\Email\\ForgotPasswordEmail')
It means our template code should match this : ForgotPasswordEmail
- Author: lekoala
Synopsis
class EmailTemplate
extends DataObject
{
- // members
- private static string $table_name = 'EmailTemplate';
- private static array $db = ;
- private static array $summary_fields = ;
- private static array $searchable_fields = ;
- private static array $indexes = ;
- private static array $translate = ;
- // methods
- public void getTitle()
- public void getCMSFields()
- public void canView()
- public void canEdit()
- public void canCreate()
- public void canDelete()
- public array getAvailableModels()
- public static EmailTemplate getByCode()
- public static BetterEmail getEmailByCode()
- public void onBeforeWrite()
- protected string mergeFieldsHelper()
- protected Tab previewTab()
- public BetterEmail getEmail()
- public BetterEmail getEmailForMember()
- public void applyTemplate()
- public string renderTemplate()
- public BetterEmail setPreviewData()
Hierarchy
Extends
- SilverStripe\ORM\DataObject
Members
private
- $db
- $indexes
- $searchable_fields
- $summary_fields
- $table_name
- $translate
Methods
protected
- mergeFieldsHelper() — Content of the literal field for the merge fields
- previewTab() — Provide content for the Preview tab
public
- applyTemplate() — Apply this template to the email
- canCreate()
- canDelete()
- canEdit()
- canView()
- getAvailableModels() — A map of Name => Class
- getByCode() — Get an email template by code
- getCMSFields()
- getEmail() — Returns an instance of an Email with the content of the template
- getEmailByCode() — A shorthand to get an email by code
- getEmailForMember() — Returns an instance of an Email with the content tailored to the member
- getTitle()
- onBeforeWrite()
- renderTemplate() — Get rendered body
- setPreviewData() — Inject random data into email for nicer preview