Quellcode durchsuchen

fix contact forms

Olivier Massot vor 5 Jahren
Ursprung
Commit
ee498e86f9

+ 2 - 1
ot_templating/Configuration/Form/CustomFormSetup.yaml

@@ -3,6 +3,7 @@ TYPO3:
   CMS:
     Form:
       persistenceManager:
-        allowSaveToExtensionPaths: true
+        allowSaveToExtensionPaths: false
+        allowDeleteFromExtensionPaths: false
         allowedExtensionPaths:
           20: EXT:ot_templating/Resources/Private/Forms/

+ 24 - 9
ot_templating/Configuration/TypoScript/setup.txt

@@ -18,13 +18,13 @@
 # TODO: Réflechir à un système pour pouvoir afficher un message sur tous les minisites, type 'Maintenance prévue le...' ou autre
 
 ## DEBUG MODE: tout commenter pour la prod ##
-config.debug = 0
-config.contentObjectExceptionHandler = 1
-config.no_cache = 0
-config.admPanel = 0
-
-plugin.tx_vhs.settings.debug = 0
-plugin.tx_vhs.settings.asset.debug = 0
+#config.debug = 1
+#config.contentObjectExceptionHandler = 0
+#config.no_cache = 1
+#config.admPanel = 0
+#
+#plugin.tx_vhs.settings.debug = 0
+#plugin.tx_vhs.settings.asset.debug = 0
 ####
 
 # **** Configuration générale ****
@@ -120,6 +120,7 @@ plugin.tx_ottemplating {
 # * Form extension
 # @see https://docs.typo3.org/c/typo3/cms-form/9.5/en-us/Introduction/Index.html
 
+# -- BE integration
 module.tx_form {
     settings {
         yamlConfigurations {
@@ -127,13 +128,15 @@ module.tx_form {
         }
     }
 }
+
+# -- FE integration
 plugin.tx_form {
     settings {
         yamlConfigurations {
             100 = EXT:ot_templating/Configuration/Form/CustomFormSetup.yaml
         }
         formDefinitionOverrides {
-            Contact {
+            ContactForm {
                 finishers {
                     0 {
                         options {
@@ -146,4 +149,16 @@ plugin.tx_form {
     }
 }
 
-
+lib.tx_ottemplating.widgets.contact = USER_INT
+lib.tx_ottemplating.widgets.contact {
+    userFunc = TYPO3\CMS\Extbase\Core\Bootstrap->run
+    extensionName = Form
+    pluginName = Formframework
+    vendorName = TYPO3\CMS
+    switchableControllerActions {
+        FormFrontend {
+            1 = perform
+        }
+    }
+    settings.persistenceIdentifier = EXT:ot_templating/Resources/Private/Forms/Contact.form.yaml
+}

+ 154 - 0
ot_templating/Resources/Private/Forms/Contact.form.yaml

@@ -0,0 +1,154 @@
+identifier: ContactForm
+label: 'Formulaire de Contact'
+prototypeName: standard
+type: Form
+
+renderingOptions:
+  controllerAction: perform
+  addQueryString: false
+  submitButtonLabel: Envoyer
+
+finishers:
+  -
+    identifier: EmailToReceiver
+    options:
+      subject: 'Demande d''information'
+      recipientAddress:
+      recipientName: ''
+      senderAddress: ne_pas_repondre@opentalent.fr
+      senderName: ''
+      replyToAddress: ''
+      carbonCopyAddress: ''
+      blindCarbonCopyAddress: ''
+      format: html
+      attachUploads: 'true'
+      translation:
+        language: ''
+  -
+    identifier: EmailToSender
+    options:
+      subject: 'Bonjour / Votre message a bien été envoyé.'
+      recipientAddress: '{mail}'
+      recipientName: '{first-name} {last-name}'
+      senderAddress: ne_pas_repondre@opentalent.fr
+      senderName: ''
+      replyToAddress: ''
+      carbonCopyAddress: ''
+      blindCarbonCopyAddress: ''
+      format: html
+      attachUploads: 'false'
+  -
+    identifier: Confirmation
+    options:
+      message: 'Votre message a bien été envoyé'
+      contentElementUid: ''
+
+renderables:
+  -
+    identifier: page-1
+    label: 'Écrivez-nous:'
+    type: Page
+
+    renderingOptions:
+      previousButtonLabel: 'Précédent'
+      nextButtonLabel: 'Suivant'
+
+    renderables:
+      -
+        type: StaticText
+        identifier: notice
+        properties:
+          text: 'Note: Les champs marqués d''une astérisque (*) sont obligatoires'
+          elementClassAttribute: 'contact-form-info'
+        label: ''
+      -
+        type: GridRow
+        identifier: row1
+        label: ''
+        renderables:
+          -
+            identifier: last-name
+            label: 'Nom'
+            type: Text
+            defaultValue: ''
+            properties:
+              fluidAdditionalAttributes:
+                required: required
+            validators:
+              - identifier: NotEmpty
+
+          -
+            identifier: first-name
+            label: 'Prénom'
+            type: Text
+            defaultValue: ''
+            properties:
+              fluidAdditionalAttributes:
+                required: required
+            validators:
+              -
+                identifier: NotEmpty
+
+      -
+        identifier: mail
+        label: 'Adresse email'
+        type: Text
+        defaultValue: ''
+        properties:
+          fluidAdditionalAttributes:
+            required: required
+        validators:
+          -
+            identifier: EmailAddress
+          -
+            identifier: NotEmpty
+
+      -
+        type: GridRow
+        identifier: row2
+        label: ''
+        renderables:
+
+          -
+            identifier: postal-code
+            label: 'Code postal'
+            type: Text
+            defaultValue: ''
+            validators:
+              -
+                identifier: Integer
+
+          -
+            identifier: city
+            label: 'Ville'
+            type: Text
+            defaultValue: ''
+
+          -
+            identifier: phone
+            label: 'Téléphone'
+            type: Text
+            defaultValue: ''
+      -
+        identifier: subject
+        label: 'Objet'
+        type: Text
+        defaultValue: ''
+        properties:
+          fluidAdditionalAttributes:
+            required: required
+        validators:
+          -
+            identifier: NotEmpty
+      -
+        identifier: message
+        label: 'Message'
+        type: Textarea
+        defaultValue: ''
+        properties:
+          fluidAdditionalAttributes:
+            placeholder: 'Votre message ici...'
+            required: required
+        validators:
+          -
+            identifier: NotEmpty

+ 3 - 2
ot_templating/Resources/Private/Layouts/Classic/Contact.html

@@ -1,4 +1,6 @@
 {namespace ot=Opentalent\OtTemplating\ViewHelpers}
+{namespace v=FluidTYPO3\Vhs\ViewHelpers}
+{namespace formvh=TYPO3\CMS\Form\ViewHelpers}
 
 <f:comment><!-- Special layout for the Contact page --></f:comment>
 <f:layout name="Contact" />
@@ -12,9 +14,8 @@
     <div class="content">
         <f:comment><!-- Contact form --></f:comment>
 
-
         <div class="contact-form">
-            <formvh:render persistenceIdentifier="EXT:ot_templating/Resources/Private/Forms/Contact.form.yaml" />
+            <f:cObject typoscriptObjectPath="lib.tx_ottemplating.widgets.contact"/>
         </div>
 
         <div class="postal-adress">

+ 3 - 1
ot_templating/Resources/Private/Layouts/Modern/Contact.html

@@ -1,4 +1,6 @@
 {namespace ot=Opentalent\OtTemplating\ViewHelpers}
+{namespace v=FluidTYPO3\Vhs\ViewHelpers}
+{namespace formvh=TYPO3\CMS\Form\ViewHelpers}
 
 <f:comment><!-- Special layout for the Contact page --></f:comment>
 <f:layout name="Contact" />
@@ -14,7 +16,7 @@
                 <div class="row">
                     <div class="col-sm-12 mt-30">
                         <div class="contact-form">
-                            <formvh:render persistenceIdentifier="EXT:ot_templating/Resources/Private/Forms/Contact.form.yaml" />
+                            <f:cObject typoscriptObjectPath="lib.tx_ottemplating.widgets.contact"/>
                         </div>
 
                         <div class="postal-adress">

+ 1 - 0
ot_templating/Resources/Private/Templates/Page/Contact.html

@@ -12,5 +12,6 @@
         <flux:grid.row>
         </flux:grid.row>
     </flux:grid>
+
 </f:section>