Skip to content

Commit

Permalink
[TASK] Update second manipulation example of the firstname
Browse files Browse the repository at this point in the history
  • Loading branch information
einpraegsam committed Jul 11, 2016
1 parent c9d9076 commit 67085c7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 13 deletions.
7 changes: 3 additions & 4 deletions Classes/Controller/FormController.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,9 @@ class FormController
*/
public function manipulateMailObjectOnCreate(Mail $mail)
{
foreach ($mail->getAnswers() as $answer) {
if ($answer->getValue() === 'alex') {
$answer->setValue('alexander');
}
// example how to get an answer from the mail object and manipulate a value (set firstname if email fits)
if ($mail->getAnswersByFieldMarker()['email']->getValue() === 'manipulatesender@powermailextended.org') {
$mail->getAnswersByFieldMarker()['firstname']->setValue('heyholetsgo');
}
}
}
18 changes: 9 additions & 9 deletions ext_localconf.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@
\TYPO3\CMS\Extbase\SignalSlot\Dispatcher::class
);

// Manipulate a value before sending
//$signalSlotDispatcher->connect(
// 'In2code\Powermail\Controller\FormController',
// 'createActionBeforeRenderView',
// 'In2code\Powermailextended\Controller\FormController',
// 'manipulateMailObjectOnCreate',
// false
//);
// Manipulate a value before sending example
$signalSlotDispatcher->connect(
\In2code\Powermail\Controller\FormController::class,
'createActionBeforeRenderView',
\In2code\Powermailextended\Controller\FormController::class,
'manipulateMailObjectOnCreate',
false
);

// Change receiver mail
// Change receiver mail example
$signalSlotDispatcher->connect(
\In2code\Powermail\Domain\Service\SendMailService::class,
'sendTemplateEmailBeforeSend',
Expand Down

0 comments on commit 67085c7

Please sign in to comment.