Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
S
sg_mail
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TYPO3
sg_mail
Commits
7b4c0021
Commit
7b4c0021
authored
5 years ago
by
Fabian Galinski
Browse files
Options
Downloads
Patches
Plain Diff
[FEATURE] Adds more functions to the mail template service. AddMarkers and better file management
parent
c5f09584
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Classes/Service/MailTemplateService.php
+30
-10
30 additions, 10 deletions
Classes/Service/MailTemplateService.php
with
30 additions
and
10 deletions
Classes/Service/MailTemplateService.php
+
30
−
10
View file @
7b4c0021
...
...
@@ -35,6 +35,7 @@ use Swift_Attachment;
use
Swift_OutputByteStream
;
use
TYPO3\CMS\Core\Database\ConnectionPool
;
use
TYPO3\CMS\Core\Mail\MailMessage
;
use
TYPO3\CMS\Core\Resource\File
;
use
TYPO3\CMS\Core\Resource\ResourceFactory
;
use
TYPO3\CMS\Core\Utility\GeneralUtility
;
use
TYPO3\CMS\Extbase\Domain\Model\FileReference
;
...
...
@@ -353,6 +354,15 @@ class MailTemplateService {
return
$this
;
}
/**
* @param array $markers
* @return MailTemplateService
*/
public
function
addMarkers
(
array
$markers
):
MailTemplateService
{
$this
->
setMarkers
(
\array_merge
(
$this
->
markers
,
$markers
));
return
$this
;
}
/**
* @param array $markers
* @return MailTemplateService
...
...
@@ -409,24 +419,34 @@ class MailTemplateService {
/**
* Adds a file resource as attachment
*
* @param FileReference $file
* @param FileReference $fileReference
* @param File $file
*
* @return MailTemplateService
* @throws \TYPO3\CMS\Core\Resource\Exception\ResourceDoesNotExistException
*/
public
function
addFileResourceAttachment
(
FileReference
$file
):
MailTemplateService
{
$originalResource
=
$file
->
getOriginalResource
();
if
(
!
$originalResource
)
{
return
$this
;
}
$originalFile
=
$originalResource
->
getOriginalFile
();
if
(
!
$originalFile
)
{
return
$this
;
public
function
addFileResourceAttachment
(
FileReference
$fileReference
=
NULL
,
File
$file
=
NULL
):
MailTemplateService
{
if
(
!
$file
)
{
if
(
!
$fileReference
)
{
return
$this
;
}
$originalResource
=
$fileReference
->
getOriginalResource
();
if
(
!
$originalResource
)
{
return
$this
;
}
$file
=
$originalResource
->
getOriginalFile
();
if
(
!
$file
)
{
return
$this
;
}
}
$coreFileReferenceMailFile
=
$this
->
resourceFactory
->
createFileReferenceObject
(
[
'uid_local'
=>
$
originalF
ile
->
getUid
(),
'uid_local'
=>
$
f
ile
->
getUid
(),
'table_local'
=>
'sys_file'
,
'uid'
=>
uniqid
(
'NEW_MAIL'
,
TRUE
)
]
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment