0

I have 2 Powermail forms on a page and one needs a custom receiverMail template. How can I specify what template file to use based on the plugin instance?

My best guess would be to do something like this:

plugin.tx_powermail {
  view {
    templateRootPath >
    templateRootPath {
      10 = EXT:powermail/Resources/Private/Templates/
      20 = CASE
      20 {
        key.field = uid
        default = fileadmin/template/powermail/Templates/
        123 = fileadmin/template/powermail/Templates2/
      }
    }
  }
} 

Using the uid of the form element this doesn't work.

user500665
  • 1,220
  • 1
  • 12
  • 38

1 Answers1

1

I would do switch or a if condition in the HTML-template. Depending on a uid, a title or even better a value in layout field.

How to set own values in layout fields is described in the manual: https://docs.typo3.org/typo3cms/extensions/powermail/Faq/Index.html#how-to-change-the-style-selector-with-my-own-values-in-forms-pages-or-fields

Alex Kellner
  • 1,263
  • 6
  • 11
  • The layout field seems to be only for adding classes to the form. I don't see how I can use it for changing mail template files. So you're saying the best way is to have one template file with an if condition? I thought it'd be tidier with separate files but I'll try it out if there's no other way. – user500665 Oct 25 '17 at 09:37
  • I just realised the layout class name is available as a variable to use in the if condition. – user500665 Oct 25 '17 at 10:02