[SOLVED] Customize contact form with backend data

Hello Community,

First things first, Im new to Neos and now i need some help from you guys :slight_smile:

Im want to customize the Contact-Form so a customer can choose the recipient email address in the backend Inspector.

At first i used the guide from the docs to ‘Add a simple contact form’.

I created a new package and already extended the Inspector:

 TYPO3.Neos.NodeTypes:Form':
  ui:
    inspector:
      groups:
        add:
          label: 'Settings'
          position: 1
  properties:
    recipientMail:
      type: string
      defaultValue: ''
      ui:
        label: 'Empfänger E-Mail Adresse'
        reloadIfChanged: TRUE
        inlineEditable: TRUE
        inspector:
          group: 'add'

At this point iam stuck. I want to use the backend data from the inspector in the email-finisher.
Is it possible to get the inspector-data into the yaml-file?

Permanent-contact-form.yaml:

finishers:
  -
    identifier: 'TYPO3.Form:Email'
    options:
      templatePathAndFilename: resource://permanent.contact/Private/Templates/Email/Message.txt
      subject: Kontaktformular - Anfrage von DevNeos
      recipientAddress: '{recipientMail}'
      recipientName: 'Damian Buecker'
      senderAddress: '{email}'
      senderName: '{firstname}{lastname}'
      replyToAddress: '{email}'
      format: plaintext

Or is there a better way to archive this ?
Thanks in advance.

Damian

Is there no solution for this problem?

It is possible … but not exactly convenient yet.

From memory this are the two necessary steps:

  1. In the template of the form plugin pass the currentNode to <form:render ... overrideConfigurations="{node:node}" > you will have to adjust the fusion/ts2 aswell to get the node as template argument
  2. Use a custom form-factory that passes the node from the overrideConfigurations to the finisher.

That way you can access any inspector field of your form content.

1 Like

Hey,
i found this: https://github.com/cron-eu/neos-formbuilder

maybe give it a try. it worked well for me :slight_smile:

1 Like

Thanks! Thats what i am looking for =)