luxletter
luxletter copied to clipboard
Add TSFE while processing variables
As mail will be sent by scheduler (BE context), we do not have a TSFE. If working with TS Variables these require a working TSFE. Adding a temporary TSFE like in f:cObject VH solves that problem.
The simple simulation is not enough, if there are more complex TS.
This works great...
lib.mailFooter = TEXT
lib.mailFooter.value = Hallo Welt
This will break with Exceptions, because the TSFE has no valid sys_page object for the enableFields DB selection.
lib.mailFooter = CONTENT
lib.mailFooter {
table = tt_content
select.pidInList = 364
select.orderBy = sorting
}
I saw no other option to build up the complete TSFE?! Any tipps/hints for my problem?
Hey guys,
I try many different things. Also building up the TSFE by hand in a custom cObject ViewHelper
$tsfeBackup = $GLOBALS['TSFE'] ?? null;
$GLOBALS['TSFE'] = GeneralUtility::makeInstance(TypoScriptFrontendController::class, null, 364, 0);
$GLOBALS['TSFE']->fe_user = GeneralUtility::makeInstance(FrontendUserAuthentication::class);
$GLOBALS['TSFE']->cObj = GeneralUtility::makeInstance(ContentObjectRenderer::class);
$GLOBALS['TSFE']->sys_page = GeneralUtility::makeInstance(PageRepository::class, GeneralUtility::makeInstance(Context::class));
$GLOBALS['TSFE']->cObjectDepthCounter = 100;
$GLOBALS['TSFE']->getPageAndRootlineWithDomain(1);
$GLOBALS['TSFE']->forceTemplateParsing = 1;
$GLOBALS['TSFE']->getConfigArray();
364 is my footer page. The preview & final mail content could select information via CONTENT cObject (no fatal error anymore) but there are several problems. Currently all links in content elements are removed (incl. the content of the link) - only in the final e-Mail. Preview works well. :-/
I also try this, but it works only in the preview and not in the final content.
luxletterPreviewNewsletter.config.absRefPrefix = https://www.my-domain-here.de/
luxletterPreviewNewsletter.config.spamProtectEmailAddresses = 0
fluidStyledMailContent.config.absRefPrefix = https://www.my-domain-here.de/
fluidStyledMailContent.config.spamProtectEmailAddresses = 0
// parseFunc
lib.parseFunc.tags.a.typolink.forceAbsoluteUrl = 1
lib.parseFunc.tags.link.typolink.forceAbsoluteUrl = 1
lib.parseFunc.tags.a.typolink.forceAbsoluteUrl.scheme = https
lib.parseFunc.tags.link.typolink.forceAbsoluteUrl.scheme = https
// parseFunc_RTE
lib.parseFunc_RTE.tags.a.typolink.forceAbsoluteUrl = 1
lib.parseFunc_RTE.tags.link.typolink.forceAbsoluteUrl = 1
lib.parseFunc_RTE.tags.a.typolink.forceAbsoluteUrl.scheme = https
lib.parseFunc_RTE.tags.link.typolink.forceAbsoluteUrl.scheme = https
It is very hard to render a content element from a central page in each footer. Any hints related to that? Creating a new colPos in the newsletter and load the content via "Shortcut" elements is a no-go for the customer. I am grateful for every tip... or are there missing components in the TSFE, that result in the error?
Other idea: Override the fetch mechanism and add the complete Fluid Template of the footer page into the original E-Mail template. But this will costs hours to integrate and I don't know if this is broken too :-/
Regards, Tim
So, what you write Tim is, that the solution of @froemken does not help here? Am I right?
Hey @einpraegsam , Unfortunately, the solutation do not help.
I have to create the full TSFE (because the cObject CONTENT need information based on the TSFE) but the RTE rendering (in the content Elements via <f:format.html>) have still problems in the linkbuilding (links are gone).
Regards, Tim
This is a pitty. I hoped that the solution of @froemken would help and we can merge it. So now I tend to not merge it.
@einpraegsam @lochmueller Sorry, the priorities have changed. Again. I have created a little hooking-extension for luxletter:
https://github.com/jweiland-net/luxletter_extended
It used various hooks/SignalSlots of Luxletter to add this missing features:
-
If you open luxletter BE module there is no given id GET parameter. Without this id, luxletter will ask Extbase BackendConfiguration to get TS Template. But this Template is just the first found sys_template. It must not be the correct one for given origin pagetree. luxletter_extended will fix this with constructor SignalSlot
-
If you send a test mail only TS of ext_typoscript_setup.typoscript will be loaded. With luxletter_extended we build our own TSFE with all sites, siteLanguage and whatever it needs. It uses the origin of individual newsletter to build correct full TS config.
-
I have added
module.tx_luxletter_lux_luxletterluxletterfor a better differentiation of BE module and FE templates -
I have implemented a new idea how to structure template for multi domain/multi pageroots
-
I have added a lot of comments to understand luxletter much better
-
Please also have a look into jwtools2 where I have added our own implementation of f:format.html. As BE does not have any TSFE, any individual build TSFE will be stored temporary in tsfeBackup of original f:format.html, which will throw away my own TSFE while processing TS. The fluid variant will fill TSFE with stdClass which will break typolink processing. Further our f:format.html has the option to add your own record for data (ContentObjectRenderer) so properties like field, data and current will work again.
-
Todo: Build a ViewHelper to get Hostname related to given origin.
Either you can wait until I have time again to build various patches, or you're using luxletter_extended or you adapt one or more changes of luxletter_extended into luxletter yourself.
Sorry...next project is waiting.
Stefan
No need to hurry from my side - thx for your time