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
Merge requests
!7
Featture forms integration
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Featture forms integration
featture_forms_integration
into
master
Overview
3
Commits
14
Changes
6
1 unresolved thread
Hide all comments
Merged
Torsten Oppermann
requested to merge
featture_forms_integration
into
master
6 years ago
Overview
3
Commits
14
Changes
6
1 unresolved thread
Hide all comments
Expand
0
0
Merge request reports
Compare
master
version 9
d3a9f5f9
6 years ago
version 8
47aa0fe3
6 years ago
version 7
76b4ac84
6 years ago
version 6
d8431890
6 years ago
version 5
af396ea5
6 years ago
version 4
0527ba3d
6 years ago
version 3
7c1573a2
6 years ago
version 2
6a0836a8
6 years ago
version 1
d9abf4e8
6 years ago
master (base)
and
latest version
latest version
5fbacdd1
14 commits,
6 years ago
version 9
d3a9f5f9
13 commits,
6 years ago
version 8
47aa0fe3
12 commits,
6 years ago
version 7
76b4ac84
11 commits,
6 years ago
version 6
d8431890
10 commits,
6 years ago
version 5
af396ea5
9 commits,
6 years ago
version 4
0527ba3d
8 commits,
6 years ago
version 3
7c1573a2
7 commits,
6 years ago
version 2
6a0836a8
6 commits,
6 years ago
version 1
d9abf4e8
5 commits,
6 years ago
6 files
+
285
−
4
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
6
Search (e.g. *.vue) (Ctrl+P)
Classes/
Service/Formhandler
Finisher
Service
.php
→
Classes/
Finisher/Forms/Forms
Finisher.php
+
70
−
0
Options
<?php
declare
(
strict_types
=
1
);
namespace
SGalinski\SgMail\
Service
;
namespace
SGalinski\SgMail\
Finisher\Forms
;
/***************************************************************
* Copyright notice
@@ -26,74 +27,44 @@ namespace SGalinski\SgMail\Service;
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
use
SGalinski\SgMail\Service\MailTemplateService
;
use
TYPO3\CMS\Core\Utility\GeneralUtility
;
use
TYPO3\CMS\Extbase\Object\ObjectManager
;
use
T
ypoheads\Formhandler
\Finisher\AbstractFinisher
;
use
T
YPO3\CMS\Form\Domain
\Finisher
s
\AbstractFinisher
;
/**
* Class FormhandlerFinisherService
*
* @package SGalinski\SgMail\Service
* This finisher sends an email to one recipient
*/
class
Form
handler
Finisher
Service
extends
AbstractFinisher
{
class
Form
s
Finisher
extends
AbstractFinisher
{
/**
* Hook into Formhandler, sets config and form input
* gets called in the finisher of the typoscript
* redirects to process() function
* Executes this finisher
*
* @param array $formInput
* @param array $settings
*/
public
function
init
(
$formInput
,
$settings
)
{
foreach
(
$formInput
as
&
$userInput
)
{
// if value is an array, iterate over array values
if
(
is_array
(
$userInput
))
{
foreach
(
$userInput
as
&
$input
)
{
$input
=
GeneralUtility
::
removeXSS
(
$input
);
}
continue
;
}
$userInput
=
GeneralUtility
::
removeXSS
(
$userInput
);
}
$this
->
gp
=
$formInput
;
$this
->
settings
=
$settings
;
}
/**
* Redirect Formhandler input to send Email Function
* Needed to hook into Formhandler
* @see AbstractFinisher::execute()
*
* @return array $gp
* @throws \BadFunctionCallException
* @throws \TYPO3\CMS\Extbase\Persistence\Exception\IllegalObjectTypeException
* @throws \InvalidArgumentException
* @throws \BadFunctionCallException
* @throws \TYPO3\CMS\Core\Cache\Exception\NoSuchCacheException
* @throws \TYPO3\CMS\Extbase\Persistence\Exception\IllegalObjectTypeException
*/
public
function
process
()
{
if
(
!
isset
(
$this
->
settings
[
'to_address'
]))
{
$toAddressField
=
$this
->
settings
[
'to_address_field'
];
$toAddress
=
$this
->
gp
[
$toAddressField
];
}
else
{
$toAddress
=
$this
->
settings
[
'to_address'
];
}
protected
function
executeInternal
()
{
$formValues
=
$this
->
finisherContext
->
getFormValues
();
$objectManager
=
GeneralUtility
::
makeInstance
(
ObjectManager
::
class
);
/** @var \SGalinski\SgMail\Service\MailTemplateService $mailTemplateService */
$mailTemplateService
=
$objectManager
->
get
(
MailTemplateService
::
class
);
$mailTemplateService
->
setToAddresses
(
$toAddress
);
$mailTemplateService
=
$objectManager
->
get
(
MailTemplateService
::
class
,
$this
->
parseOption
(
'template'
),
$this
->
parseOption
(
'extension'
),
$formValues
);
$mailTemplateService
->
setIgnoreMailQueue
(
FALSE
);
$mailTemplateService
->
setLanguage
(
$GLOBALS
[
'TSFE'
]
->
config
[
'config'
][
'language'
]);
$mailTemplateService
->
setFromAddress
(
$this
->
settings
[
'from_address'
]);
$mailTemplateService
->
setTemplateName
(
$this
->
settings
[
'template_key'
]);
$mailTemplateService
->
setExtensionKey
(
$this
->
settings
[
'extension_key'
]);
$mailTemplateService
->
setMarkers
(
$this
->
gp
);
$mailTemplateService
->
setIgnoreMailQueue
(
$this
->
settings
[
'ignore_mail_queue'
]
==
TRUE
);
$mailTemplateService
->
sendEmail
();
$mailTemplateService
->
setSubject
(
$this
->
parseOption
(
'subject'
));
$mailTemplateService
->
setToAddresses
(
$this
->
parseOption
(
'mailTo'
));
$mailTemplateService
->
setFromAddress
(
$this
->
parseOption
(
'mailFrom'
));
$mailTemplateService
->
setFromName
(
$this
->
parseOption
(
'userName'
));
$mailTemplateService
->
setReplyToAddress
(
$this
->
parseOption
(
'replyTo'
));
$mailTemplateService
->
setCcAddresses
(
$this
->
parseOption
(
'cc'
));
$mailTemplateService
->
setBccAddresses
(
$this
->
parseOption
(
'bcc'
));
return
$this
->
gp
;
$mailTemplateService
->
sendEmail
()
;
}
}
Loading