Skip to content

Instantly share code, notes, and snippets.

@benjaminrau
Last active December 30, 2015 22:06
Show Gist options
  • Save benjaminrau/6341998 to your computer and use it in GitHub Desktop.
Save benjaminrau/6341998 to your computer and use it in GitHub Desktop.
Dynamic recipients for powermail with powermail field defined via typscript and fallback for recipient when no recipient is defined
Create a Hidden Form Field named recipient
Define Recipient Email as: {f:cObject(typoscriptObjectPath:'lib.receiveremail')}
Define Recipient Name as: {f:cObject(typoscriptObjectPath:'lib.receivername')}
plugin.tx_clocations {
settings {
# cat=plugin.tx_clocations//a; type=string; label=Contact Form PID
contactFormPid =
# cat=plugin.tx_clocations//a; type=string; label=Contact Form Reciever Field ID
contactFormReceiverFid =
}
}
temp.contactFormReceiver = GP:tx_powermail_pi1|field|{$plugin.tx_clocations.settings.contactFormReceiverFid}
[globalVar = TSFE:id = {$plugin.tx_clocations.settings.contactFormPid}]
page.config.no_cache = 1
[globalVar = {$temp.contactFormReceiver} != 0]
lib.receivername = CONTENT
lib.receivername {
table = tx_clocations_domain_model_contact
select.selectFields = fullname
select.pidInList={$plugin.tx_clocations.persistence.storagePid}
select.where.data = GP:tx_powermail_pi1|field|{$plugin.tx_clocations.settings.contactFormReceiverFid}
select.where.wrap = deleted=0 AND hidden=0 AND uid=|
select.where.intval = 1
renderObj = TEXT
renderObj.field = fullname
}
lib.receiveremail = CONTENT
lib.receiveremail {
table = tx_clocations_domain_model_contact
select.selectFields = email
select.pidInList={$plugin.tx_clocations.persistence.storagePid}
select.where.data = GP:tx_powermail_pi1|field|{$plugin.tx_clocations.settings.contactFormReceiverFid}
select.where.wrap = deleted=0 AND hidden=0 AND uid=|
select.where.intval = 1
renderObj = TEXT
renderObj.field = email
}
[else]
lib.receiveremail = TEXT
lib.receiveremail.value = xxx@codearts.at
lib.receivername = TEXT
lib.receivername.value = Codearts
[global]
[global]
@Hobokens
Copy link

Hi,
I just found your code and I'm wondering where to find the extension tx_clocations.

Regards
Hobokens

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment