kitzberger / form-mailtext

TYPO3 extension to enhance EXT:form by custom mail texts per form plugin
7 stars 5 forks source link

Get default value output not message output #17

Open bh-teufels opened 2 years ago

bh-teufels commented 2 years ago

Hello

i get the default "all values" output not my output defined in "Mail Text". i debugged EMailFinisher.php and inside initializeStandaloneView & initializeFluidEmail the $message is the correct one.

seems that the EMail Template not using the one from your Extension i tried to override the Template in my own config but not working either.

finishersDefinition:
            EmailToSender:
              options:
                templateRootPaths:
                  20: 'EXT:form_mailtext/Resources/Private/Frontend/Templates/Finishers/Email/'
                  99: 'EXT:my_ext/Resources/Private/Overrides/form/Frontend/Templates/Finishers/Email/'
              # Extra field 'message' in finisher config in form plugin
              FormEngine:
                elements:
                  message:
                    label: 'formEditor.elements.Form.finisher.EmailToSender.editor.message.label'
                    config:
                      type: text
                      enableRichtext: true
                      eval: required
              formEditor:
                predefinedDefaults:
                  options:
                    message: "Hi, here's your input: {variables}"
            EmailToReceiver:
              options:
                templateRootPaths:
                  20: 'EXT:form_mailtext/Resources/Private/Frontend/Templates/Finishers/Email/'
                  99: 'EXT:my_ext/Resources/Private/Overrides/form/Frontend/Templates/Finishers/'
              # Extra field 'message' in finisher config in form plugin
              FormEngine:
                elements:
                  message:
                    label: 'formEditor.elements.Form.finisher.EmailToReceiver.editor.message.label'
                    config:
                      type: text
                      enableRichtext: true
                      eval: required
              formEditor:
                predefinedDefaults:
                  options:
                    message: "Hi, here's the users input: {variables}"

Typo3: 11.5.9 form_mailtext: 2.1.2 PHP: 7.4.3

bh-teufels commented 2 years ago

if i copy your Default.html Template in own override Folder and rename it (eg.: Contact.html) and set templateName in Form Configuration (templateName: Contact)
it is working.

kitzberger commented 2 years ago

@bh-teufels, thanks for reaching out!

That's odd ;-/ The default templateName for the two finishers EmailToReceiver and EmailToSender is Default, see https://github.com/TYPO3-CMS/form/blob/main/Configuration/Yaml/Finishers/EmailToReceiver.yaml#L10

Maybe you have had that changed to Contact in your config somewhere else than the snippet from aboe? In that case you obviously need to provide a template with that name. Which you did ;-)

bh-teufels commented 2 years ago

No i changed the templateName only when it didn't work . before i copied your Default.html Template File i also tried with templateName: Default in my configuration an not copy the Template File but that has not worked either.

kitzberger commented 2 years ago

@bh-teufels, what TYPO3 version you're on?

bh-teufels commented 2 years ago

i am on the latest 11.5.9 PHP 7.4 form_mailtext 2.1.2

kitzberger commented 2 years ago

@bh-teufels, I've just had a go with those versions and it's all working smoothly.

How's your TypoScript setup looking like?

plugin.tx_form {
    settings {
        yamlConfigurations {
            ???
        }
    }
}

Maybe there's an index conflict with your custom configuration? This extension here is using index 100.

bh-teufels commented 2 years ago

i using index 110

plugin.tx_form { settings { yamlConfigurations {

index '100' reserved by form_mailtext

        110 = EXT:my_ext/Configuration/Form/BasicContactFormSetup.yaml
    }
}

}

kitzberger commented 2 years ago

@bh-teufels, what happens when you use 20 instead?

bh-teufels commented 2 years ago

so using am index lower than 100 i don't know have to try it. but I won't be able to check it this week

medarob commented 2 years ago

I think I experienced the same/similar problem in TYPO3 10.4 (currently on TYPO3 10.4.27).

Problem: I was wondering why the E-Mail from the form was empty.

In BE form editor When I add {variables} into the new message field then it works but I think that shouldn't be necessary?

When I tried to delete the {variables} value again I got the error that the form is not correctly configured. grafik

Setup.yaml

TYPO3:
  CMS:
    Form:
      persistenceManager:
        allowedExtensionPaths:
          10: EXT:my_extension/Resources/Private/__Form/
        allowSaveToExtensionPaths: true
        allowDeleteFromExtensionPaths: true
      prototypes:
        standard:
          formElementsDefinition:
            Form:
              renderingOptions:
                templateRootPaths:
                  150: 'EXT:my_extension/Resources/Private/__Form/Templates/'
                partialRootPaths:
                  150: 'EXT:my_extension/Resources/Private/__Form/Partials/'
                layoutRootPaths:
                  150: 'EXT:my_extension/Resources/Private/__Form/Layouts/'
          finishersDefinition:
            EmailToSender:
              formEditor:
                predefinedDefaults:
                  options:
                    message: "{variables}"
            EmailToReceiver:
              formEditor:
                predefinedDefaults:
                  options:
                    message: "{variables}"

grafik