Skip to content
Snippets Groups Projects
Commit e7483412 authored by Torsten Oppermann's avatar Torsten Oppermann
Browse files

[TASK] Update documentation wip

parent 22382bd3
No related branches found
No related tags found
1 merge request!3New version 4 1
......@@ -213,84 +213,14 @@ This extension uses two database tables:
The extbase model classes for these tables are located at the *Domain\Model* folder.
### Service Classes
##### Register Interface
To register your extension you need at least one implementation of this interface.
Inside the **init()** function of your Implementation you should define variables for the following purposes:
###### Template Key
A unique Identifier for this particular template. It should be obvious from the template key for what purpose this template is intended.
###### Extension Key
The extension key of the TYPO3 extension registering with sg_mail. This should be the same for all of your extensions!
###### Description
A brief description about the template, visible in the backend module
###### subject
The default subject text for the emails. It is possible to specify language specific texts with an associative array:
[
'en' => 'english subject',
'de' => 'german subject',
...
]
###### markers
This is an array of information for substitute variables that are used to replace certain values at runtime.
Each Array element should be its own array and structured like this:
[
'marker' => 'marker_name',
'type' => \SGalinski\SgMail\Service\MailTemplateService::MARKER_TYPE_STRING,
'value' => 'some value',
'description' => 'This marker is used for X in the email'
]
marker = the variable name you use in the template
type = the date type of the variable
value = an example value, visible in the backend to the editors
description = a brief description for what this variable is intended for
Finally you have to call the function **\SGalinski\SgMail\Service\MailTemplateService::registerTemplate** (this is only marked deprecated for public use)
inside your **register()** function and pass all the necessary values.
Now you can register the class in your **ext_localconf.php** with
\SGalinski\SgMail\Service\MailTemplateService::registerByFile('SGalinski\SgMail\Example\Register');
You find a complete example of this process in the file **SGalinski\SgMail\Example\Register**
---
#### MailTemplateService
This class provides you with an API to the mailing functionality and various helper functions regarding the your templates.
Here is an overview of some important functions:
###### function registerTemplate
A static function that adds your template to the service. Should be called from within your **Register** class (see **RegisterInterface**).
###### function registerByFile
Registers a template by providing a complete class name of your **RegisterInterface** implementation as an argument.
Needs to be called from within your **ext_localconf.php**.
###### function getDefaultTemplateMarker
Reads custom example template marker from your **locallang.xlf**. This is only useful if you need multi language examples in your Backend Marker
###### function getRegisterArray
Returns an array of all registered templates, with each element in the following format:
[
'templatePath' => '/path/to/template',
'description' => 'description of the template',
'marker' => $arrayOfMarkers,
'extension' => 'extension_key',
'templateName' => 'unique_template_name',
'subject' => 'The mail subject',
'usage' => 'optional description of this templates usage'
]
###### function loadPredefinedValuesForTemplate
Sets the predefined values for this template that have been supplied by the editor. Use this method if you have no custom values for
......@@ -302,10 +232,6 @@ Sends your mail or adds it to the mailing queue, depending on the settings. You
###### function sendMailFromQueue
Forces the sending of an E-Mail from within the queue. If it has already been sent, it gets send again.
###### function setRegisterArray
Enables you to overwrite the register array. This overwrites **ALL** registered templates with the supplied data
and should be handled with care.
###### function addAttachment
With this function you can add attachments to your mail. The attachment must be of type *Swift_OutputByteStream*. You must also specify the content-type of the attachment.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment