Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add TSFE while processing variables #45

Open
froemken opened this issue Sep 21, 2020 · 7 comments
Open

Add TSFE while processing variables #45

froemken opened this issue Sep 21, 2020 · 7 comments
Labels
bug Something isn't working

Comments

@froemken
Copy link
Contributor

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.

froemken added a commit to jweiland-net/luxletter that referenced this issue Sep 21, 2020
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.

Resolves: in2code-de#45
@einpraegsam einpraegsam added the bug Something isn't working label Sep 22, 2020
@lochmueller
Copy link

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?

@lochmueller
Copy link

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

@einpraegsam
Copy link
Collaborator

So, what you write Tim is, that the solution of @froemken does not help here? Am I right?

@lochmueller
Copy link

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

@einpraegsam
Copy link
Collaborator

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.

@froemken
Copy link
Contributor Author

@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_luxletterluxletter for 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

@einpraegsam
Copy link
Collaborator

No need to hurry from my side - thx for your time

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants