Reputation: 22099
I'm trying to place a link on the submit page of my powermail setup.
You'd think this is a simple task, but bear with me.
My Powermail form has 2 hidden fields which are prefilled with a page ID and a page title.
These belong to the page I later want to return to, after having sent the mail. By putting these values in the form, I hoped to have access to them whenever I need them in the process.
I prefill these hidden fields from TypoScript like so:
plugin.tx_powermail {
settings {
setup {
prefill {
// Hidden "back to" page ID. This is the page you may want to return to after sending a mail.
backto = TEXT
backto.data = GP:backTo
backto.if.isTrue.data = GP:backTo
backtotext = TEXT
backtotext.noTrimWrap = |Back to ||
backtotext.data = GP:title
backtotext.if.isTrue.data = GP:title
backtotext.htmlSpecialChars = 1
}
}
}
}
Given that Powermail claims you can now use Fluid ViewHelpers in your content sections, I though, great, let's use the PageViewHelper, like so:
{f:link.page(pageUid:'{backto}')}
But where does my link text go? More inline notation to the rescue!
{backtotext -> f:link.page(pageUid:'{backto}')}
Seems like the inline notation is not fully supported. I thought I was smart by simply using:
{f:link.page(pageUid:'{backto}')}{backtotext}
But this leaves the <a>
tag open, which has very undesirable effects...
So - No link for me!
So I thought I would simply construct the link in TypoScript and render it on the page via
{f:cObject(typoscriptObjectPath:'lib.myBackLink')}
But I can't see any way to access the variables from the (sent) Powermail form in TS. So I don't have access to the page ID or title.
So I thought, if the default PageViewHelper only wants to render its children as its content, maybe I can roll my own ViewHelper that accepts the content as a parameter!
But how would I make that ViewHelper known to the system so that I can use it in my customized Powermail templates?
I've only used Fluid inside of my extensions before. It was obvious how Fluid would look up the correct ViewHelper by name, by what if I want to use a ViewHelper in my fileadmin folder hierarchy?
So, why not just use a normal link by using <a href="http://www.page.com/?id={backto}">{backtotext}</a>
in the RTE?
TYPO3 realizes, that that is an illegal reference, and quickly turns the link into:
And the resulting output will simply not be a link.
So, that doesn't work either.
OK, so I change the target to <a href="http://www.page.com?id={backto}">{backtotext}</a>
(removed a slash). Now the URL is no longer recognized as internal and is marked with data-htmlarea-external="1"
. This causes my link to actually be fully evaluated and rendered (yay).
But it is now treated like an external link, RealURL no longer affects it and it is subject to external link _target
behavior.
Why is this so difficult? What am I not understanding?
Upvotes: 0
Views: 4062
Reputation: 22099
As it turned out, none of the previously attempted solution actually worked.
To get things over with, I just replaced the web
section in the PowermailAll
template, like so:
Section for Web view
<f:section name="web">
</a>
</f:section>
And then I used the following in my Submit Page content:
{f:link.page(pageUid:'{backto}')}{backtotext}{powermail_all}
Problem solved. I guess...
Upvotes: 1
Reputation: 4578
In RTE you have to use <link ###pageid###>
instead of <a href="...">
.
Have a look into the RTE DB field contents (or hit the no RTE checkbox) on how to use the link elements.
Upvotes: 1