Minzkraut
Minzkraut

Reputation: 2187

Add formhandler field data to subject

My goal is to have the Formhandler log UID inside the Admin emails subject.
Inside of my email template I'm using
###value_tx_formhandler_log_inserted_uid### to insert a unique id.
I need to get this value into my Admin emails subject. E.g.

"Order ID: ###value_tx_formhandler_log_inserted_uid###"

I've read various forum posts, each do something different and I ended up with this snippet:

plugin.Tx_Formhandler.settings.predef.form {

    # TEMPLATE MARKERS
    name = Form1
    templateFile = typo3template/typo3/ext/formhandler/form1/default.html

    markers {
        name = TEXT
        name.value = Form1
    }

   finishers {
     1.config {
         class = Tx_Formhandler_Finisher_Mail
         subject = TEXT
         subject.value = ###GP:tx_formhandler_log_inserted_uid###
     }
   }  
[...]

which just yields "{$formhandler.admin.subject}" as the subject.

I also tried other variations like ###LLL:tx_formhandler_log_inserted_uid### or tx_formhandler_log_inserted_uid
The backend field "subject" is empty.
Pasting the HTML placeholder into the backend field didn't work either.
I can't get this to work.

Upvotes: 0

Views: 100

Answers (2)

Minzkraut
Minzkraut

Reputation: 2187

After a lot of trial and error, I got it working.
First of all, I forgot to specify that I want to configure the admin mail.
Adding admin { fixed the problem of getting only {$formhandler.admin.subject}.

The UID value itself can be accessed with GP:formhandler|tx_formhandler_log_inserted_uid I combined that with the noTrimWrap as suggested by @bernd-wilke-πφ

The final snippet looks like this:

finishers {
     1 {
        class = Tx_Formhandler_Finisher_Mail
            config {
                admin {
                    subject = TEXT
                    subject.data = GP:formhandler|tx_formhandler_log_inserted_uid
                    subject.noTrimWrap = |Order number: ||
                }
            }
        }
    } 

Upvotes: 0

Bernd Wilke πφ
Bernd Wilke πφ

Reputation: 10790

In what way can you access the id you want to insert?

From the notation GP:tx_formhandler_log_inserted_uid I would assume a GET/POST value.
For using this value in typoscript you need to do it like this (or similar: dataWrap):

subject = TEXT
subject.data = GP:tx_formhandler_log_inserted_uid
subject.noTrimWrap = |Order ID: ||

The notation LLL:tx_formhandler_log_inserted_uid would be a language specific text (you would also insert by .data) but it would be a static text for each language.

Upvotes: 1

Related Questions