Skip to content
Snippets Groups Projects
Commit 0527ba3d authored by Paul Ilea's avatar Paul Ilea
Browse files

[TASK] Update Form finishers configuration, add mail templates

parent 7c1573a2
No related branches found
Tags 3.8.5
1 merge request!7Featture forms integration
Showing
with 190 additions and 325 deletions
......@@ -52,10 +52,11 @@ class FormsFinisher extends AbstractFinisher {
$objectManager = GeneralUtility::makeInstance(ObjectManager::class);
/** @var \SGalinski\SgMail\Service\MailTemplateService $mailTemplateService */
$mailTemplateService = $objectManager->get(
MailTemplateService::class, $this->parseOption('template'), 'sg_mail', $formValues
MailTemplateService::class, $this->parseOption('template'), $this->parseOption('extension'), $formValues
);
$mailTemplateService->setIgnoreMailQueue(TRUE);
$mailTemplateService->setLanguage($GLOBALS['TSFE']->config['config']['language']);
$mailTemplateService->setSubject($this->parseOption('subject'));
$mailTemplateService->setToAddresses($this->parseOption('mailTo'));
$mailTemplateService->setFromAddress($this->parseOption('mailFrom'));
......
<?php
/***************************************************************
* Copyright notice
*
* (c] sgalinski Internet Services (https://www.sgalinski.de]
*
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
* free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option] any later version.
*
* The GNU General Public License can be found at
* http://www.gnu.org/copyleft/gpl.html.
*
* This script is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
return [
'extension_key' => 'sg_mail',
'template_key' => 'contact_admin',
'description' => 'LLL:EXT:sg_mail/Resources/Private/Language/locallang.xlf:mail.contact_admin.description',
'markers' => [
[
'marker' => 'name',
'type' => \SGalinski\SgMail\Service\MailTemplateService::MARKER_TYPE_STRING,
'value' => 'Max Mustermann',
'description' => 'LLL:EXT:sg_mail/Resources/Private/Language/locallang.xlf:mail.marker.name',
],
[
'marker' => 'email',
'type' => \SGalinski\SgMail\Service\MailTemplateService::MARKER_TYPE_STRING,
'value' => 'max.mustermann@info.de',
'description' => 'LLL:EXT:sg_mail/Resources/Private/Language/locallang.xlf:mail.marker.email',
],
[
'marker' => 'message',
'type' => \SGalinski\SgMail\Service\MailTemplateService::MARKER_TYPE_STRING,
'value' => ' ',
'description' => 'LLL:EXT:sg_mail/Resources/Private/Language/locallang.xlf:mail.marker.message',
]
]
];
<?php
/***************************************************************
* Copyright notice
*
* (c] sgalinski Internet Services (https://www.sgalinski.de]
*
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
* free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option] any later version.
*
* The GNU General Public License can be found at
* http://www.gnu.org/copyleft/gpl.html.
*
* This script is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
return [
'extension_key' => 'sg_mail',
'template_key' => 'contact_user',
'description' => 'LLL:EXT:sg_mail/Resources/Private/Language/locallang.xlf:mail.contact_user.description',
'markers' => [
[
'marker' => 'name',
'type' => \SGalinski\SgMail\Service\MailTemplateService::MARKER_TYPE_STRING,
'value' => 'Max Mustermann',
'description' => 'LLL:EXT:sg_mail/Resources/Private/Language/locallang.xlf:mail.marker.name',
],
[
'marker' => 'email',
'type' => \SGalinski\SgMail\Service\MailTemplateService::MARKER_TYPE_STRING,
'value' => 'max.mustermann@info.de',
'description' => 'LLL:EXT:sg_mail/Resources/Private/Language/locallang.xlf:mail.marker.email',
],
[
'marker' => 'message',
'type' => \SGalinski\SgMail\Service\MailTemplateService::MARKER_TYPE_STRING,
'value' => ' ',
'description' => 'LLL:EXT:sg_mail/Resources/Private/Language/locallang.xlf:mail.marker.message',
]
]
];
......@@ -24,14 +24,10 @@ module.tx_sgmail {
# frontend configuration for ext:forms
plugin.tx_form.settings.yamlConfigurations {
1499086547 = EXT:sg_mail/Configuration/Yaml/Forms/BaseSetup.yaml
1499086867 = EXT:sg_mail/Configuration/Yaml/Forms/FormEngineSetup.yaml
11254100 = EXT:sg_mail/Configuration/Yaml/Forms/CustomFormSetup.yaml
1499086546 = EXT:sg_mail/Configuration/Yaml/Forms/FinisherSetupFE.yaml
}
# Backend configuration for ext:forms
module.tx_form.settings.yamlConfigurations {
1499086547 = EXT:sg_mail/Configuration/Yaml/Forms/BaseSetup.yaml
1499086867 = EXT:sg_mail/Configuration/Yaml/Forms/FormEditorSetup.yaml
1499088215 = EXT:sg_mail/Configuration/Yaml/Forms/FormEngineSetup.yaml
1499086546 = EXT:sg_mail/Configuration/Yaml/Forms/FinisherSetupBE.yaml
}
TYPO3:
CMS:
Form:
persistenceManager:
allowedExtensionPaths:
10: EXT:sg_mail/Resources/Private/Forms/
allowSaveToExtensionPaths: true
allowDeleteFromExtensionPaths: true
prototypes:
standard:
finishersDefinition:
MailToSenderFinisher:
implementationClassName: SGalinski\SgMail\Finisher\Forms\FormsFinisher
MailToReceiverFinisher:
implementationClassName: SGalinski\SgMail\Finisher\Forms\FormsFinisher
formElementsDefinition:
Form:
renderingOptions:
templateRootPaths:
100: 'EXT:sg_mail/Resources/Private/Forms/Templates/'
partialRootPaths:
100: 'EXT:sg_mail/Resources/Private/Forms/Partials/'
layoutRootPaths:
100: 'EXT:sg_mail/Resources/Private/Forms/Layouts/'
\ No newline at end of file
TYPO3:
CMS:
Form:
prototypes:
standard:
formElementsDefinition:
Form:
renderingOptions:
translation:
translationFile:
# default translation files for the frontend
10: 'EXT:form/Resources/Private/Language/locallang.xlf'
20: 'EXT:sg_mail/Resources/Private/Language/locallang_db.xlf'
\ No newline at end of file
......@@ -3,6 +3,36 @@ TYPO3:
Form:
prototypes:
standard:
finishersDefinition:
MailToSenderFinisher:
formEditor:
iconIdentifier: 't3-form-icon-finisher'
label: 'A Label that seems to be never used...'
predefinedDefaults:
options:
extension: 'sg_mail'
template: 'contact_user'
mailTo: ''
subject: ''
userName: ''
replyTo: ''
cc: ''
bcc: ''
MailToReceiverFinisher:
formEditor:
iconIdentifier: 't3-form-icon-finisher'
label: 'A Label that seems to be never used...'
predefinedDefaults:
options:
extension: 'sg_mail'
template: 'contact_admin'
mailTo: ''
mailFrom: ''
subject: ''
userName: ''
replyTo: ''
cc: ''
bcc: ''
formElementsDefinition:
Form:
formEditor:
......@@ -27,42 +57,17 @@ TYPO3:
100:
label: "Mail Templates - E-Mail to the website user"
110:
identifier: 'extension'
templateName: 'Inspector-TextEditor'
label: 'Extension key'
propertyPath: 'options.extension'
120:
identifier: 'template'
templateName: 'Inspector-SingleSelectEditor'
templateName: 'Inspector-TextEditor'
label: 'Unique Template name'
propertyPath: 'options.template'
selectOptions:
0:
value: 'template1'
label: 'Template 1'
1:
value: 'template2'
label: 'Template 2'
2:
value: 'template3'
label: 'Template 3'
3:
value: 'template4'
label: 'Template 4'
4:
value: 'template5'
label: 'Template 5'
5:
value: 'template6'
label: 'Template 6'
6:
value: 'template7'
label: 'Template 7'
7:
value: 'template8'
label: 'Template 8'
8:
value: 'template9'
label: 'Template 9'
9:
value: 'template10'
label: 'Template 10'
120:
enableFormelementSelectionButton: true
130:
identifier: 'mailTo'
templateName: 'Inspector-TextEditor'
label: 'The email address of the website user'
......@@ -71,17 +76,17 @@ TYPO3:
propertyValidators:
10: 'NotEmpty'
20: 'FormElementIdentifierWithinCurlyBracesInclusive'
125:
140:
identifier: 'mailFrom'
templateName: 'Inspector-TextEditor'
label: 'The email address of the website'
propertyPath: 'options.mailFrom'
160:
150:
identifier: 'subject'
templateName: 'Inspector-TextEditor'
label: 'The subject of the E-Mail'
propertyPath: 'options.subject'
170:
160:
identifier: 'userName'
templateName: 'Inspector-TextEditor'
label: 'The name of the website user'
......@@ -90,17 +95,17 @@ TYPO3:
propertyValidators:
10: 'NotEmpty'
20: 'FormElementIdentifierWithinCurlyBracesInclusive'
190:
170:
identifier: 'replyTo'
templateName: 'Inspector-TextEditor'
label: 'The reply to address of the E-Mail'
propertyPath: 'options.replyTo'
200:
180:
identifier: 'cc'
templateName: 'Inspector-TextEditor'
label: 'The cc address of the E-Mail'
propertyPath: 'options.cc'
210:
190:
identifier: 'bcc'
templateName: 'Inspector-TextEditor'
label: 'The bcc address of the E-Mail'
......@@ -113,97 +118,47 @@ TYPO3:
100:
label: "Mail Templates - E-Mail to the website admin"
110:
identifier: 'extension'
templateName: 'Inspector-TextEditor'
label: 'Extension key'
propertyPath: 'options.extension'
120:
identifier: 'template'
templateName: 'Inspector-SingleSelectEditor'
label: 'Unique Template name'
templateName: 'Inspector-TextEditor'
label: 'Template key'
propertyPath: 'options.template'
selectOptions:
0:
value: 'template1'
label: 'Template 1'
1:
value: 'template2'
label: 'Template 2'
2:
value: 'template3'
label: 'Template 3'
3:
value: 'template4'
label: 'Template 4'
4:
value: 'template5'
label: 'Template 5'
5:
value: 'template6'
label: 'Template 6'
6:
value: 'template7'
label: 'Template 7'
7:
value: 'template8'
label: 'Template 8'
8:
value: 'template9'
label: 'Template 9'
9:
value: 'template10'
label: 'Template 10'
120:
enableFormelementSelectionButton: true
130:
identifier: 'mailTo'
templateName: 'Inspector-TextEditor'
label: 'The email address of the website admin'
propertyPath: 'options.mailTo'
125:
140:
identifier: 'mailFrom'
templateName: 'Inspector-TextEditor'
label: 'The email address of the website'
propertyPath: 'options.mailFrom'
160:
150:
identifier: 'subject'
templateName: 'Inspector-TextEditor'
label: 'The subject of the E-Mail'
propertyPath: 'options.subject'
190:
160:
identifier: 'replyTo'
templateName: 'Inspector-TextEditor'
label: 'The "reply to" address of the E-Mail'
propertyPath: 'options.replyTo'
200:
180:
identifier: 'cc'
templateName: 'Inspector-TextEditor'
label: 'The cc address of the E-Mail'
propertyPath: 'options.cc'
210:
190:
identifier: 'bcc'
templateName: 'Inspector-TextEditor'
label: 'The bcc address of the E-Mail'
propertyPath: 'options.bcc'
# Backend options
finishersDefinition:
MailToSenderFinisher:
formEditor:
iconIdentifier: 't3-form-icon-finisher'
label: 'A Label that seems to be never used...'
predefinedDefaults:
options:
template: 'template1'
mailTo: ''
subject: ''
userName: ''
replyTo: ''
cc: ''
bcc: ''
MailToReceiverFinisher:
formEditor:
iconIdentifier: 't3-form-icon-finisher'
label: 'A Label that seems to be never used...'
predefinedDefaults:
options:
template: 'template2'
mailTo: ''
mailFrom: ''
subject: ''
userName: ''
replyTo: ''
cc: ''
bcc: ''
\ No newline at end of file
renderingOptions:
translation:
translationFile:
90: 'EXT:project_theme/Resources/Private/Language/forms.xlf'
\ No newline at end of file
TYPO3:
CMS:
Form:
prototypes:
standard:
finishersDefinition:
MailToSenderFinisher:
implementationClassName: SGalinski\SgMail\Finisher\Forms\FormsFinisher
MailToReceiverFinisher:
implementationClassName: SGalinski\SgMail\Finisher\Forms\FormsFinisher
\ No newline at end of file
#TYPO3:
# CMS:
# Form:
# prototypes:
# standard:
# finishersDefinition:
# MailToSenderFinisher:
# FormEngine:
# label: ''
# elements:
# format:
# label: 'tt_content.finishersDefinition.EmailToSender.format.label'
# config:
# type: select
# renderType: 'selectSingle'
# minitems: 1
# maxitems: 1
# size: 1
# items:
# 10:
# 0: 'tt_content.finishersDefinition.EmailToSender.format.1'
# 1: 'html'
# 20:
# 0: 'tt_content.finishersDefinition.EmailToSender.format.2'
# 1: 'plaintext'
\ No newline at end of file
<html xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers" xmlns:formvh="http://typo3.org/ns/TYPO3/CMS/Form/ViewHelpers" data-namespace-typo3-fluid="true">
<f:form.validationResults for="{element.rootForm.identifier}.{element.identifier}">
<div class="form-group{f:if(condition: '{validationResults.errors.0}', then: ' has-error')}">
<div class="{element.properties.containerClassAttribute}">
<label class="control-label smart-label" for="{element.uniqueIdentifier}">
{formvh:translateElementProperty(element: element, property: 'label')}
<f:if condition="{element.required}">
<f:render partial="Field/Required" />
</f:if>
</label>
<f:format.raw>
{elementContent}
<f:if condition="{validationResults.flattenedErrors}">
<span class="error help-block" role="alert">
<f:for each="{validationResults.errors}" as="error">
{formvh:translateElementError(element: element, code: error.code, arguments: error.arguments, defaultValue: error.message)}
<br />
</f:for>
</span>
</f:if>
</f:format.raw>
<f:if condition="{element.properties.elementDescription}">
<span class="help-block">{formvh:translateElementProperty(element: element, property: 'elementDescription')}</span>
</f:if>
</div>
</div>
</f:form.validationResults>
</html>
\ No newline at end of file
<html xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers" xmlns:formvh="http://typo3.org/ns/TYPO3/CMS/Form/ViewHelpers" data-namespace-typo3-fluid="true">
<span class="required">*</span>
</html>
<html xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers" xmlns:formvh="http://typo3.org/ns/TYPO3/CMS/Form/ViewHelpers" data-namespace-typo3-fluid="true">
<formvh:renderRenderable renderable="{page}">
<f:if condition="{page.label}">
<h2>{formvh:translateElementProperty(element: page, property: 'label')}</h2>
</f:if>
<f:for each="{page.elements}" as="element">
<f:render partial="{element.templateName}" arguments="{element: element}" />
</f:for>
</formvh:renderRenderable>
</html>
<html xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers" xmlns:formvh="http://typo3.org/ns/TYPO3/CMS/Form/ViewHelpers" data-namespace-typo3-fluid="true">
<formvh:renderRenderable renderable="{element}">
<f:render partial="Field/Field" arguments="{element: element}" contentAs="elementContent">
<f:form.textfield
property="{element.identifier}"
id="{element.uniqueIdentifier}"
class="{element.properties.elementClassAttribute} form-control"
errorClass="{element.properties.elementErrorClassAttribute}"
additionalAttributes="{formvh:translateElementProperty(element: element, property: 'fluidAdditionalAttributes')}"
/>
</f:render>
</formvh:renderRenderable>
</html>
<html xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers" xmlns:formvh="http://typo3.org/ns/TYPO3/CMS/Form/ViewHelpers" data-namespace-typo3-fluid="true">
<formvh:renderRenderable renderable="{element}">
<f:render partial="Field/Field" arguments="{element: element}" contentAs="elementContent">
<f:form.textarea
property="{element.identifier}"
id="{element.uniqueIdentifier}"
class="{element.properties.elementClassAttribute} form-control"
rows="5"
cols="20"
errorClass="{element.properties.elementErrorClassAttribute}"
additionalAttributes="{formvh:translateElementProperty(element: element, property: 'fluidAdditionalAttributes')}"
/>
</f:render>
</formvh:renderRenderable>
</html>
renderingOptions:
submitButtonLabel: element.Form.renderingOptions.submitButtonLabel
type: Form
identifier: contactForm
label: 'Contact Form'
prototypeName: standard
finishers:
-
options:
format: html
template: template1
mailTo: '{text-2}'
subject: 'Ihre Kontaktanfrage'
userName: '{text-1}'
replyTo: ''
cc: ''
bcc: ''
identifier: MailToSenderFinisher
-
options:
template: template2
mailTo: admin@sgalinski.de
mailFrom: info@sgalinski.de
subject: 'Eine neue Kontaktanfrage'
userName: ''
replyTo: ''
cc: ''
bcc: ''
identifier: MailToReceiverFinisher
renderables:
-
renderingOptions:
previousButtonLabel: 'Previous step'
nextButtonLabel: 'Next step'
type: Page
identifier: page-1
label: 'Sie haben eine Frage?'
renderables:
-
defaultValue: ''
type: Text
identifier: text-1
label: Name
properties:
fluidAdditionalAttributes:
required: required
placeholder: Name
elementDescription: ''
validators:
-
identifier: NotEmpty
-
defaultValue: ''
type: Text
identifier: text-2
label: 'Ihre E-Mail-Adresse'
properties:
fluidAdditionalAttributes:
placeholder: 'Ihre E-Mail-Adresse'
required: required
validators:
-
identifier: NotEmpty
-
identifier: EmailAddress
-
defaultValue: ''
type: Textarea
identifier: textarea-1
label: Nachricht
properties:
fluidAdditionalAttributes:
placeholder: Nachricht
required: required
validators:
-
identifier: NotEmpty
New Contact Request!
Name: {name}
Email: {email}
Message: {message}
Your Request
Name: {name}
Email: {email}
Your Message: {message}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment