Commit 357699ce authored by David Steeb's avatar David Steeb
Browse files

[TASK] Add EXT:form

Add extension form, add custom styling, templates, and configuration, remove finishers not to be used, remove field types not to be shown in demo projects.
parent 9629f6c7
......@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "64150aa92aef4f4be9f5397da15de08b",
"content-hash": "52a4316d84a479405a89eb18f5a45613",
"packages": [
{
"name": "b13/assetcollector",
......@@ -5796,6 +5796,70 @@
},
"time": "2021-02-16T06:23:48+00:00"
},
{
"name": "typo3/cms-form",
"version": "v10.4.13",
"source": {
"type": "git",
"url": "https://github.com/TYPO3-CMS/form.git",
"reference": "c8aed75d84f93fe587fe0d47ed75937fd7c38380"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/TYPO3-CMS/form/zipball/c8aed75d84f93fe587fe0d47ed75937fd7c38380",
"reference": "c8aed75d84f93fe587fe0d47ed75937fd7c38380",
"shasum": ""
},
"require": {
"psr/http-message": "^1.0",
"symfony/expression-language": "^4.4 || ^5.0",
"typo3/cms-core": "10.4.13"
},
"conflict": {
"typo3/cms": "*"
},
"suggest": {
"typo3/cms-filelist": "Listing of files in the directory",
"typo3/cms-impexp": "Import and Export of records from TYPO3 in a custom serialized format (.T3D) for data exchange with other TYPO3 systems."
},
"type": "typo3-cms-framework",
"extra": {
"branch-alias": {
"dev-master": "10.4.x-dev"
},
"typo3/cms": {
"Package": {
"partOfFactoryDefault": true
},
"extension-key": "form"
}
},
"autoload": {
"psr-4": {
"TYPO3\\CMS\\Form\\": "Classes/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"GPL-2.0-or-later"
],
"authors": [
{
"name": "TYPO3 Core Team",
"email": "typo3cms@typo3.org",
"role": "Developer"
}
],
"description": "Form Library, Plugin and Editor",
"homepage": "https://typo3.org",
"support": {
"chat": "https://typo3.org/help",
"docs": "https://docs.typo3.org/c/typo3/cms-form/master/en-us",
"issues": "https://forge.typo3.org",
"source": "https://github.com/TYPO3/TYPO3.CMS"
},
"time": "2021-02-16T06:23:48+00:00"
},
{
"name": "typo3/cms-frontend",
"version": "v10.4.13",
......
......@@ -23,6 +23,7 @@ class PageConfiguration
public const DOKTYPE_APPLE = 11;
public const DOKTYPE_RECIPE = 12;
public const DOKTYPE_OVERVIEW = 13;
public const DOKTYPE_CONTACTPAGE = 14;
protected array $backendLayoutMapping = [
self::DOKTYPE_CONTENTPAGE => 'pagets__Contentpage',
......@@ -30,6 +31,7 @@ class PageConfiguration
self::DOKTYPE_APPLE => 'pagets__Applepage',
self::DOKTYPE_RECIPE => 'pagets__Recipepage',
self::DOKTYPE_OVERVIEW => 'pagets__Overviewpage',
self::DOKTYPE_CONTACTPAGE => 'pagets__Contactform'
];
public function getBackendLayout(int $doktype): string
......
mod.web_layout.BackendLayouts.Contactform {
title = LLL:EXT:site_t3demo/Resources/Private/Language/locallang_db.xlf:backendlayout.contactform.title
config {
backend_layout {
colCount = 1
rowCount = 2
rows {
1 {
columns {
1 {
name = LLL:EXT:site_t3demo/Resources/Private/Language/locallang_db.xlf:backendlayout.stage.name
colPos = 1
allowed.CType = keyvisual
}
}
}
2 {
columns {
1 {
name = LLL:EXT:site_t3demo/Resources/Private/Language/locallang_db.xlf:backendlayout.maincontent.name
colPos = 0
allowed.CType = contentstage,textmedia,form_formframework
}
}
}
}
}
}
}
......@@ -49,6 +49,7 @@ $doktypesToAdd = [
['recipe', PageConfiguration::DOKTYPE_RECIPE],
['startpage', PageConfiguration::DOKTYPE_STARTPAGE],
['overview', PageConfiguration::DOKTYPE_OVERVIEW],
['contactform', PageConfiguration::DOKTYPE_CONTACTPAGE, 'special'],
];
foreach ($doktypesToAdd as $item) {
......@@ -59,7 +60,7 @@ foreach ($doktypesToAdd as $item) {
'LLL:EXT:site_t3demo/Resources/Private/Language/locallang_db.xlf:pages.doktype.' . $item[0],
$item[1],
'',
'default'
$item[2] ?? 'default'
]
);
$GLOBALS['TCA']['pages']['ctrl']['typeicon_classes'][$item[1]] = 'apps-pagetree-page-default';
......
......@@ -13,4 +13,6 @@ plugin.tx_assetcollector.icons {
arrow-up = EXT:site_t3demo/Resources/Public/Assets/SVGs/arrow-up.svg
arrow-down = EXT:site_t3demo/Resources/Public/Assets/SVGs/arrow-down.svg
x = EXT:site_t3demo/Resources/Public/Assets/SVGs/x.svg
check = EXT:site_t3demo/Resources/Public/Assets/SVGs/check.svg
more = EXT:site_t3demo/Resources/Public/Assets/SVGs/more.svg
}
plugin.tx_form {
view {
templateRootPaths.10 = EXT:site_t3demo/Resources/Private/Plugins/Form/Templates/
partialRootPaths.10 = EXT:site_t3demo/Resources/Private/Plugins/Form/Partials/
layoutRootPaths.10 = EXT:site_t3demo/Resources/Private/Plugins/Form/Layouts/
}
settings {
yamlConfigurations {
100 = EXT:site_t3demo/Configuration/Yaml/FormSetup.yaml
}
}
}
module.tx_form {
settings {
yamlConfigurations {
100 = EXT:site_t3demo/Configuration/Yaml/FormSetup.yaml
}
}
}
......@@ -2,12 +2,14 @@
@import 'EXT:seo/Configuration/TypoScript/XmlSitemap/setup.typoscript'
@import 'EXT:felogin/Configuration/TypoScript/setup.typoscript'
@import 'EXT:form/Configuration/TypoScript/setup.typoscript'
@import 'EXT:site_t3demo/Configuration/TypoScript/Setup/lib.fluidPage.typoscript'
@import 'EXT:site_t3demo/Configuration/TypoScript/Setup/lib.parseFunc_RTE.typoscript'
@import 'EXT:site_t3demo/Configuration/TypoScript/Setup/plugin.tx_assetcollector.typoscript'
@import 'EXT:site_t3demo/Configuration/TypoScript/Setup/plugin.tx_picture.typoscript'
@import 'EXT:site_t3demo/Configuration/TypoScript/Setup/plugin.tx_felogin.typoscript'
@import 'EXT:site_t3demo/Configuration/TypoScript/Setup/plugin.tx_form.typoscript'
@import 'EXT:site_t3demo/Configuration/TypoScript/Setup/tt_content.faqlist.typoscript'
......
TYPO3:
CMS:
Form:
persistenceManager:
allowedExtensionPaths:
10: EXT:site_t3demo/Resources/Private/Plugins/Form/Forms/
prototypes:
standard:
formElementsDefinition:
# remove field types we do not show or have no custom template/styling for
FileUpload: null
ImageUpload: null
AdvancedPassword: null
DatePicker: null
ContentElement: null
# remove responsive options/field width from text input fields (not used)
Text:
formEditor:
editors:
700: null
# reset the grid class to only use 2 or 1 column
GridRow:
properties:
elementClassAttribute: 'b_form__row'
gridColumnClassAutoConfiguration:
viewPorts:
xs:
classPattern: 'b_form__col'
sm: null
md: null
lg: null
Form:
formEditor:
editors:
900:
# remove finishers not needed or wanted for demo project
selectOptions:
# email finishers: we do not want to send out any emails
20: null
30: null
# "delete upload": no file uploads possible
50: null
renderingOptions:
templateRootPaths:
20: 'EXT:site_t3demo/Resources/Private/Plugins/Form/Templates/'
partialRootPaths:
20: 'EXT:site_t3demo/Resources/Private/Plugins/Form/Partials/'
layoutRootPaths:
20: 'EXT:site_t3demo/Resources/Private/Plugins/Form/Layouts/'
# remove honeypot from visible area for rtl languages as well
Honeypot:
properties:
styleAttribute: 'position: absolute; margin-top: 0; margin-bottom: 0; margin-block: -999em 0;'
......@@ -79,6 +79,10 @@
<source>Server Reset Banner (shown on all pages)</source>
<target>Server Reset Banner (wird auf allen Seiten verwendet)</target>
</trans-unit>
<trans-unit id="backendlayout.contactform.title" res_name="backendlayout.contactform.title">
<source>Contact Page (w/ Contact Form)</source>
<target>Kontaktseite (mit Kontaktformular)</target>
</trans-unit>
<trans-unit id="pages.doktype.contentpage" res_name="pages.doktype.contentpage">
<source>Content Page</source>
<target>Inhaltsseite</target>
......@@ -99,6 +103,10 @@
<source>Overview Page (Apples/Recipes)</source>
<target>Übersichtsseite (Äpfel/Rezepte)</target>
</trans-unit>
<trans-unit id="pages.doktype.contactform" res_name="pages.doktype.contactform">
<source>Contact Page (w/ Contact Form)</source>
<target>Kontaktseite (mit Kontaktformular)</target>
</trans-unit>
<trans-unit id="pages.palettes.teaserdata.label" res_name="pages.palettes.teaserdata.label">
<source>Teaser Data</source>
<target>Teaserdaten</target>
......
......@@ -61,6 +61,9 @@
<trans-unit id="backendlayout.resetbanner.name" res_name="backendlayout.resetbanner.name">
<source>Server Reset Banner (shown on all pages)</source>
</trans-unit>
<trans-unit id="backendlayout.contactform.title" res_name="backendlayout.contactform.title">
<source>Contact Page (w/ Contact Form)</source>
</trans-unit>
<trans-unit id="pages.doktype.contentpage" res_name="pages.doktype.contentpage">
<source>Content Page</source>
</trans-unit>
......@@ -76,6 +79,9 @@
<trans-unit id="pages.doktype.overview" res_name="pages.doktype.overview">
<source>Overview Page (Apples/Recipes)</source>
</trans-unit>
<trans-unit id="pages.doktype.contactform" res_name="pages.doktype.contactform">
<source>Contact Page (w/ Contact Form)</source>
</trans-unit>
<trans-unit id="pages.palettes.teaserdata.label" res_name="pages.palettes.teaserdata.label">
<source>Teaser Data</source>
</trans-unit>
......
<html
xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers"
data-namespace-typo3-fluid="true"
>
<f:layout name="Default"/>
<f:section name="Main">
<f:if condition="{f:cObject(typoscriptObjectPath: 'lib.hasContent', data: '{colPos: 0}')}">
<div class="b_page__maincontent">
<div class="b_contentcontainer b_contentcontainer--text">
{f:cObject(typoscriptObjectPath: 'lib.renderContent', data: '{colPos: 0}')}
</div>
</div>
</f:if>
</f:section>
</html>
renderingOptions:
submitButtonLabel: Submit
type: Form
identifier: contactForm
label: 'Contact Form'
prototypeName: standard
finishers:
-
options:
pageUid: '98'
additionalParameters: ''
identifier: Redirect
renderables:
-
renderingOptions:
previousButtonLabel: 'Previous step'
nextButtonLabel: 'Next step'
type: Page
identifier: page-1
label: 'Contact Form'
renderables:
-
type: GridRow
identifier: gridrow-1
label: 'Grid: Row'
renderables:
-
defaultValue: ''
type: Text
identifier: text-1
label: 'First Name'
properties:
elementDescription: ''
-
defaultValue: ''
type: Text
identifier: text-2
label: 'Last Name'
properties:
elementDescription: ''
-
defaultValue: ''
type: Email
identifier: email-1
label: 'Email address'
validators:
-
identifier: EmailAddress
-
defaultValue: ''
type: Textarea
identifier: textarea-1
label: 'Your message'
-
type: Checkbox
identifier: checkbox-1
label: 'I am aware that this contact form is a demo'
properties:
fluidAdditionalAttributes:
required: required
validationErrorMessages:
-
code: 1221560910
message: 'You know we won''t contact you back, do you?'
-
code: 1221560718
message: 'You know we won''t contact you back, do you?'
-
code: 1347992400
message: 'You know we won''t contact you back, do you?'
-
code: 1347992453
message: 'You know we won''t contact you back, do you?'
validators:
-
identifier: NotEmpty
renderingOptions:
submitButtonLabel: Submit
type: Form
identifier: kontaktformular
label: Kontaktformular
prototypeName: standard
finishers:
-
options:
pageUid: '98'
additionalParameters: ''
identifier: Redirect
renderables:
-
renderingOptions:
previousButtonLabel: zurück
nextButtonLabel: weiter
type: Page
identifier: page-1
label: Kontaktformular
renderables:
-
type: GridRow
identifier: gridrow-1
label: 'Grid: Zeile'
renderables:
-
defaultValue: ''
type: Text
identifier: text-1
label: Vorname
properties:
elementDescription: ''
-
defaultValue: ''
type: Text
identifier: text-2
label: Nachname
properties:
elementDescription: ''
-
defaultValue: ''
type: Email
identifier: email-1
label: E-Mail-Adresse
validators:
-
identifier: EmailAddress
-
defaultValue: ''
type: Textarea
identifier: textarea-1
label: 'Deine Nachricht'
-
type: Checkbox
identifier: checkbox-1
label: 'Ich habe verstanden, dass dieses Formular nur eine Demo ist'
properties:
fluidAdditionalAttributes:
required: required
validationErrorMessages:
-
code: 1221560910
message: 'Du weißt, dass wir diese Nachricht nicht lesen werden, oder?'
-
code: 1221560718
message: 'Du weißt, dass wir diese Nachricht nicht lesen werden, oder?'
-
code: 1347992400
message: 'Du weißt, dass wir diese Nachricht nicht lesen werden, oder?'
-
code: 1347992453
message: 'Du weißt, dass wir diese Nachricht nicht lesen werden, oder?'
validators:
-
identifier: NotEmpty
<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, doNotShowLabel: 1}" contentAs="elementContent">
<f:form.checkbox
property="{element.identifier}"
id="{element.uniqueIdentifier}"
class="b_form__checkbox {element.properties.elementClassAttribute}"
value="{element.properties.value}"
errorClass="{element.properties.elementErrorClassAttribute}"
additionalAttributes="{formvh:translateElementProperty(element: element, property: 'fluidAdditionalAttributes')}"
/>
<label class="b_form__label b_form__label--checkbox {element.properties.elementClassAttribute}" for="{element.uniqueIdentifier}">
<span>{formvh:translateElementProperty(element: element, property: 'label')}<f:if condition="{element.required}"><f:render partial="Field/Required" /></f:if></span>
</label>
</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.textfield
type="date"
property="{element.identifier}"
id="{element.uniqueIdentifier}"
class="b_form__text b_form__text--date {element.properties.elementClassAttribute}"
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.textfield
type="email"
property="{element.identifier}"
id="{element.uniqueIdentifier}"
class="b_form__text b_form__text--email {element.properties.elementClassAttribute}"
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"
>
<f:form.validationResults for="{element.rootForm.identifier}.{element.identifier}">
<div class="b_form__group {f:if(condition: '{validationResults.errors.0}', then: 'b_form__group--has-error')}">
<f:if condition="{doNotShowLabel} != 1">
<label class="b_form__label" for="{element.uniqueIdentifier}">{formvh:translateElementProperty(element: element, property: 'label')}<f:if condition="{element.required}"><f:render partial="Field/Required" /></f:if></label>
</f:if>
<f:if condition="{validationResults.flattenedErrors}">
<span class="b_form__error" role="alert">
<f:for each="{validationResults.errors}" as="error">
<f:format.htmlspecialchars>{formvh:translateElementError(element: element, error: error)}</f:format.htmlspecialchars>
<br />
</f:for>
</span>
</f:if>
<div class="b_form__field b_form__field--{element.properties.containerClassAttribute}">
<f:format.raw>
{elementContent}
</f:format.raw>
<f:if condition="{element.properties.elementDescription}">
<span class="b_form__field-help">{formvh:translateElementProperty(element: element, property: 'elementDescription')}</span>
</f:if>
</div>
</div>
</f:form.validationResults>
</html>
<html
xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers"
data-namespace-typo3-fluid="true"
>
<span class="b_form__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="{element}">
<fieldset id="{element.uniqueIdentifier}" class="b_form__fieldset {element.properties.elementClassAttribute}">
<f:if condition="{element.label}">
<legend class="b_form__legend">{formvh:translateElementProperty(element: element, property: 'label')}</legend>
</f:if>