diff --git a/Classes/Utility/MailUtility.php b/Classes/Utility/MailUtility.php index 48149b2..93bc423 100644 --- a/Classes/Utility/MailUtility.php +++ b/Classes/Utility/MailUtility.php @@ -79,6 +79,10 @@ class MailUtility $type = 'tableLayout'; $textPart = substr($textPart, 3); } + if (substr($textPart, 0, 3) === '---') { + $type = 'divider'; + $textPart = substr($textPart, 3); + } if (substr($textPart, 0, 9) === '%subject ') { $type = 'subject'; $textPart = substr($textPart, 9); @@ -223,6 +227,7 @@ class MailUtility switch($row['type']) { case 'text': case 'table': + case 'tablelr': case 'tableLayout': case 'list': case 'textbold': @@ -233,6 +238,8 @@ class MailUtility case 'buttonleft': case 'buttoncenter': case 'buttonright': + case 'divider': + case 'hr': $row['data'] = str_replace( "\\\n", '', @@ -308,77 +315,10 @@ class MailUtility $bodydataText[] = $textRow; $bodydataHtml[] = $htmlRow; break; - //case 'button': - // $row['data'] = str_replace( - // "\\\n", - // '', - // $row['data'] - // ); - // $htmlRow = $row; - // $htmlRow['data'] = preg_replace_callback( - // '/\[.*\]/mU', - // function($matches) { - // foreach ($matches as $match) { - // $test = preg_replace_callback( - // '/\[(\S*)\s(.*)\]/mU', - // function($matchesInner) { - // - // return '' - // . $matchesInner[2] - // . ''; - // }, - // $match - // ); - // \TYPO3\CMS\Extbase\Utility\DebuggerUtility::var_dump( - // $test, null, 3, true, false - // ); - // return $test; - // } - // }, - // $htmlRow['data'] - // ); - // \TYPO3\CMS\Extbase\Utility\DebuggerUtility::var_dump( - // $htmlRow['data'], null, 3, true, false - // ); - // $htmlRow['data'] = preg_replace_callback( - // '/\*.*\*/mU', - // function($matches) { - // foreach ($matches as $match) { - // return '' - // . substr($match, 1, -1) - // . ''; - // } - // }, - // $htmlRow['data'] - // ); - // $textRow = $row; - // $textRow['data'] = preg_replace_callback( - // '/\[.*\]/mU', - // function($matches) { - // foreach ($matches as $match) { - // return preg_replace_callback( - // '/\[(\S*)\s(.*)\]/mU', - // function($matchesInner) { - // if ( - // $matchesInner[2] == $matchesInner[1] - // ) { - // return $matchesInner[1]; - // } - // return $matchesInner[2] - // . ': ' - // . $matchesInner[1]; - // }, - // $match - // ); - // } - // }, - // $textRow['data'] - // ); - // $bodydataText[] = $textRow; - // $bodydataHtml[] = $htmlRow; - // break; + case 'contentBlockHtml': + $htmlRow = $row; + $bodydataHtml[] = $htmlRow; + break; case 'attachment': $mail->attach(new \Swift_Attachment( $row['data'][0], @@ -402,9 +342,6 @@ class MailUtility } $textView->assign('content', $bodydataText); $htmlView->assign('content', $bodydataHtml); - //\TYPO3\CMS\Extbase\Utility\DebuggerUtility::var_dump( - // $bodydataHtml, null, 8, true, false - //); $domain = $settings['mailDomain']; if ($assetDomain) { $domain = $assetDomain; @@ -457,4 +394,23 @@ class MailUtility } } } + + /** + * Debug print + */ + public static function printMaildata($maildata) + { + foreach ($maildata as $row) { + if (!is_array($row['data'])) { + print($row['data']); + } else { + print($row['data'][0]); + print(PHP_EOL); + print($row['data'][1]); + } + print(PHP_EOL); + } + print(PHP_EOL); + } + } diff --git a/Resources/Private/Partials/Mails/DefaultHtml.html b/Resources/Private/Partials/Mails/DefaultHtml.html index a704f4d..23ae25e 100644 --- a/Resources/Private/Partials/Mails/DefaultHtml.html +++ b/Resources/Private/Partials/Mails/DefaultHtml.html @@ -24,12 +24,17 @@ + + {row.data -> f:format.raw()} + + + + + + + {row.data -> f:format.nl2br() -> f:format.raw()} @@ -137,6 +182,9 @@ + + + @@ -178,11 +226,19 @@ - + + + + + + + + + - - + + {row.data.1 -> f:format.nl2br() -> f:format.raw()}
+
{row.data -> f:format.nl2br() -> f:format.raw()}