Process 'mailMarkersHook'
bernd-reindl opened this issue · 0 comments
bernd-reindl commented
Hello.
Since the property 'dmailer' of class 'DirectMailTeam\DirectMail\Dmailer' is protected, i can't access the 'sys_language_uid' from 'sys_dmail_rec' anymore. But this is important for my marker.
public function processMarkers(&$params, $obj){
$languageId = $obj->dmailer['sys_dmail_rec']['sys_language_uid'];
So please send the 'sys_dmail_rec' array within the params array.
protected function replaceMailMarkers(string $content, array $recipRow, array $markers): string
{
// Hook allows to manipulate the markers to add salutation etc.
if (isset($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/direct_mail']['res/scripts/class.dmailer.php']['mailMarkersHook'])) {
$mailMarkersHook =& $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/direct_mail']['res/scripts/class.dmailer.php']['mailMarkersHook'];
if (is_array($mailMarkersHook)) {
$hookParameters = [
'sys_dmail_rec' => $this->dmailer['sys_dmail_rec'],
'row' => &$recipRow,
'markers' => &$markers,
];
$hookReference = &$this;
foreach ($mailMarkersHook as $hookFunction) {
GeneralUtility::callUserFunction($hookFunction, $hookParameters, $hookReference);
}
}
}
// replace %23%23%23 with ###, since typolink generated link with urlencode
$content = str_replace('%23%23%23', '###', $content);
return $this->getMarkerBasedTemplateService()->substituteMarkerArray($content, $markers);
}
Best regards
Bernd