[FEATURE] Introduce conditional variants for form elements
[Packages/TYPO3.CMS.git] / typo3 / sysext / form / Configuration / Yaml / BaseSetup.yaml
1 TYPO3:
2   CMS:
3     Form:
4       persistenceManager:
5         allowedFileMounts:
6           10: 1:/form_definitions/
7           20: 1:/user_upload/
8         allowSaveToExtensionPaths: false
9         allowDeleteFromExtensionPaths: false
10         #allowedExtensionPaths:
11           #10: EXT:example/Resources/Private/Forms/
12
13       prototypes:
14         standard:
15
16           ########### DEFAULT FORM ELEMENT DEFINITIONS ###########
17           formElementsDefinition:
18
19             ### BASE ELEMENTS ###
20             Form:
21               __inheritances:
22                 10: 'TYPO3.CMS.Form.mixins.formElementMixins.BaseFormElementMixin'
23               rendererClassName: 'TYPO3\CMS\Form\Domain\Renderer\FluidFormRenderer'
24               renderingOptions:
25                 __inheritances:
26                   10: 'TYPO3.CMS.Form.mixins.translationSettingsMixin'
27                 templateRootPaths:
28                   10: 'EXT:form/Resources/Private/Frontend/Templates/'
29                 partialRootPaths:
30                   10: 'EXT:form/Resources/Private/Frontend/Partials/'
31                 layoutRootPaths:
32                   10: 'EXT:form/Resources/Private/Frontend/Layouts/'
33                 addQueryString: false
34                 argumentsToBeExcludedFromQueryString: []
35                 additionalParams: []
36                 controllerAction: perform
37                 httpMethod: post
38                 httpEnctype: 'multipart/form-data'
39                 _isCompositeFormElement: false
40                 _isTopLevelFormElement: true
41
42                 honeypot:
43                   enable: true
44                   formElementToUse: 'Honeypot'
45
46                 submitButtonLabel: 'Submit'
47
48                 # set this to TRUE if you want to avoid exceptions for FormElements without definitions
49                 skipUnknownElements: true
50
51             ### FORM ELEMENTS: CONTAINER ###
52             Page:
53               __inheritances:
54                 10: 'TYPO3.CMS.Form.mixins.formElementMixins.BaseFormElementMixin'
55               implementationClassName: 'TYPO3\CMS\Form\Domain\Model\FormElements\Page'
56               renderingOptions:
57                 _isTopLevelFormElement: true
58                 _isCompositeFormElement: true
59                 nextButtonLabel: 'next Page'
60                 previousButtonLabel: 'previous Page'
61
62             SummaryPage:
63               __inheritances:
64                 10: 'TYPO3.CMS.Form.prototypes.standard.formElementsDefinition.Page'
65               renderingOptions:
66                 _isTopLevelFormElement: true
67                 _isCompositeFormElement: false
68                 nextButtonLabel: 'next Page'
69                 previousButtonLabel: 'previous Page'
70
71             Fieldset:
72               __inheritances:
73                 10: 'TYPO3.CMS.Form.mixins.formElementMixins.FormElementMixin'
74               implementationClassName: 'TYPO3\CMS\Form\Domain\Model\FormElements\Section'
75               renderingOptions:
76                 _isCompositeFormElement: true
77
78             GridContainer:
79               __inheritances:
80                 10: 'TYPO3.CMS.Form.mixins.formElementMixins.FormElementMixin'
81               implementationClassName: 'TYPO3\CMS\Form\Domain\Model\FormElements\GridContainer'
82               renderingOptions:
83                 _isCompositeFormElement: true
84                 _isGridContainerFormElement: true
85               properties:
86                 elementClassAttribute: 'container'
87                 # overrules 'GridRow.properties.gridColumnClassAutoConfiguration'
88                 gridColumnClassAutoConfiguration:
89                   gridSize: 12
90                   viewPorts:
91                     xs:
92                       classPattern: 'col-xs-{@numbersOfColumnsToUse}'
93                     sm:
94                       classPattern: 'col-sm-{@numbersOfColumnsToUse}'
95                     md:
96                       classPattern: 'col-md-{@numbersOfColumnsToUse}'
97                     lg:
98                       classPattern: 'col-lg-{@numbersOfColumnsToUse}'
99
100             GridRow:
101               __inheritances:
102                 10: 'TYPO3.CMS.Form.mixins.formElementMixins.FormElementMixin'
103               implementationClassName: 'TYPO3\CMS\Form\Domain\Model\FormElements\GridRow'
104               properties:
105                 elementClassAttribute: 'row'
106                 gridColumnClassAutoConfiguration:
107                   gridSize: 12
108                   viewPorts:
109                     xs:
110                       classPattern: 'col-xs-{@numbersOfColumnsToUse}'
111                     sm:
112                       classPattern: 'col-sm-{@numbersOfColumnsToUse}'
113                     md:
114                       classPattern: 'col-md-{@numbersOfColumnsToUse}'
115                     lg:
116                       classPattern: 'col-lg-{@numbersOfColumnsToUse}'
117               renderingOptions:
118                 _isCompositeFormElement: true
119                 _isGridRowFormElement: true
120
121             ### FORM ELEMENTS: INPUT ###
122             Text:
123               __inheritances:
124                 10: 'TYPO3.CMS.Form.mixins.formElementMixins.TextMixin'
125
126             Password:
127               __inheritances:
128                 10: 'TYPO3.CMS.Form.mixins.formElementMixins.TextMixin'
129
130             AdvancedPassword:
131               __inheritances:
132                 10: 'TYPO3.CMS.Form.prototypes.standard.formElementsDefinition.Password'
133               implementationClassName: 'TYPO3\CMS\Form\Domain\Model\FormElements\GenericFormElement'
134               properties:
135                 elementClassAttribute: 'input-medium'
136                 confirmationLabel: ''
137                 # Optional description (hint) for the first password input element
138                 #passwordDescription: ''
139                 confirmationClassAttribute: 'input-medium'
140
141             Textarea:
142               __inheritances:
143                 10: 'TYPO3.CMS.Form.mixins.formElementMixins.TextMixin'
144               properties:
145                 elementClassAttribute: 'xxlarge'
146
147             Honeypot:
148               __inheritances:
149                 10: 'TYPO3.CMS.Form.mixins.formElementMixins.TextMixin'
150               properties:
151                 renderAsHiddenField: false
152                 styleAttribute: 'position:absolute; margin:0 0 0 -999em;'
153               variants:
154                 -
155                   identifier: hide-1
156                   renderingOptions:
157                     enabled: false
158                   condition: 'stepType == "SummaryPage" || finisherIdentifier in ["EmailToSender", "EmailToReceiver"]'
159
160             Hidden:
161               __inheritances:
162                 10: 'TYPO3.CMS.Form.mixins.formElementMixins.FormElementMixin'
163               variants:
164                 -
165                   identifier: hide-1
166                   renderingOptions:
167                     enabled: false
168                   condition: 'stepType == "SummaryPage" || finisherIdentifier in ["EmailToSender", "EmailToReceiver"]'
169
170             ### FORM ELEMENTS: HTML5 ###
171             Email:
172               __inheritances:
173                 10: 'TYPO3.CMS.Form.mixins.formElementMixins.TextMixin'
174               validators:
175                 -
176                   identifier: EmailAddress
177
178             Telephone:
179               __inheritances:
180                 10: 'TYPO3.CMS.Form.mixins.formElementMixins.TextMixin'
181               validators:
182                 -
183                   identifier: RegularExpression
184                   options:
185                     regularExpression: '/^.*$/'
186
187             Url:
188               __inheritances:
189                 10: 'TYPO3.CMS.Form.mixins.formElementMixins.TextMixin'
190               validators:
191                 -
192                   identifier: RegularExpression
193                   options:
194                     regularExpression: '/^.*$/'
195
196             Number:
197               __inheritances:
198                 10: 'TYPO3.CMS.Form.mixins.formElementMixins.TextMixin'
199               validators:
200                 -
201                   identifier: Number
202
203             Date:
204               __inheritances:
205                 10: 'TYPO3.CMS.Form.mixins.formElementMixins.TextMixin'
206               properties:
207                 # Rules for the summary step, email finishers etc. but
208                 # **not** for the form element value itself.
209                 # The display format of the form element value depends on the browser settings.
210                 displayFormat: 'd.m.Y'
211                 fluidAdditionalAttributes:
212                   # https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/date#Handling_browser_support
213                   # https://tools.ietf.org/html/rfc3339#section-5.6 -> full-date
214                   pattern: '([0-9]{4})-(0[1-9]|1[012])-(0[1-9]|1[0-9]|2[0-9]|3[01])'
215
216             ### FORM ELEMENTS: SELECT ###
217             Checkbox:
218               __inheritances:
219                 10: 'TYPO3.CMS.Form.mixins.formElementMixins.FormElementMixin'
220               properties:
221                 elementClassAttribute: 'add-on'
222                 containerClassAttribute: 'input checkbox'
223                 value: 1
224
225             MultiCheckbox:
226               __inheritances:
227                 10: 'TYPO3.CMS.Form.mixins.formElementMixins.MultiSelectionMixin'
228               properties:
229                 containerClassAttribute: 'input checkbox'
230
231             MultiSelect:
232               __inheritances:
233                 10: 'TYPO3.CMS.Form.mixins.formElementMixins.MultiSelectionMixin'
234               properties:
235                 elementClassAttribute: 'xlarge'
236
237             RadioButton:
238               __inheritances:
239                 10: 'TYPO3.CMS.Form.mixins.formElementMixins.SingleSelectionMixin'
240               properties:
241                 elementClassAttribute: 'xlarge'
242
243             SingleSelect:
244               __inheritances:
245                 10: 'TYPO3.CMS.Form.mixins.formElementMixins.SingleSelectionMixin'
246
247             ### FORM ELEMENTS: CUSTOM ###
248             DatePicker:
249               __inheritances:
250                 10: 'TYPO3.CMS.Form.mixins.formElementMixins.FormElementMixin'
251               properties:
252                 elementClassAttribute: 'small form-control'
253                 timeSelectorClassAttribute: 'mini'
254                 timeSelectorHourLabel: ''
255                 timeSelectorMinuteLabel: ''
256                 dateFormat: 'Y-m-d'
257                 enableDatePicker: true
258                 displayTimeSelector: false
259
260             StaticText:
261               __inheritances:
262                 10: 'TYPO3.CMS.Form.mixins.formElementMixins.ReadOnlyFormElementMixin'
263               properties:
264                 text: ''
265
266             ContentElement:
267               __inheritances:
268                 10: 'TYPO3.CMS.Form.mixins.formElementMixins.ReadOnlyFormElementMixin'
269               properties:
270                 contentElementUid: ''
271
272             ### FORM ELEMENTS: UPLOADS ###
273             FileUpload:
274               __inheritances:
275                 10: 'TYPO3.CMS.Form.mixins.formElementMixins.FileUploadMixin'
276               properties:
277                 allowedMimeTypes: ['application/msword', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/vnd.oasis.opendocument.text', 'application/pdf']
278
279             ImageUpload:
280               __inheritances:
281                 10: 'TYPO3.CMS.Form.mixins.formElementMixins.FileUploadMixin'
282               properties:
283                 allowedMimeTypes: ['image/jpeg', 'image/png', 'image/bmp']
284                 elementClassAttribute: 'lightbox'
285                 imageLinkMaxWidth: 500
286                 imageMaxWidth: 500
287                 imageMaxHeight: 500
288
289           ### FINISHERS ###
290
291           finishersDefinition:
292             Closure:
293               implementationClassName: 'TYPO3\CMS\Form\Domain\Finishers\ClosureFinisher'
294               options:
295                 #closure:
296
297             Confirmation:
298               implementationClassName: 'TYPO3\CMS\Form\Domain\Finishers\ConfirmationFinisher'
299               #options:
300                 #message: ''
301                 #contentElementUid: 0
302                 #typoscriptObjectPath: 'lib.tx_form.contentElementRendering'
303
304             EmailToSender:
305               __inheritances:
306                 10: 'TYPO3.CMS.Form.mixins.finishersEmailMixin'
307
308             EmailToReceiver:
309               __inheritances:
310                 10: 'TYPO3.CMS.Form.mixins.finishersEmailMixin'
311
312             DeleteUploads:
313               implementationClassName: 'TYPO3\CMS\Form\Domain\Finishers\DeleteUploadsFinisher'
314
315             FlashMessage:
316               implementationClassName: 'TYPO3\CMS\Form\Domain\Finishers\FlashMessageFinisher'
317               #options:
318                 #messageBody: ''
319                 #messageTitle: ''
320                 #messageArguments: {}
321                 #messageCode: 0
322                 #severity: 0
323
324             Redirect:
325               implementationClassName: 'TYPO3\CMS\Form\Domain\Finishers\RedirectFinisher'
326               #options:
327                 #pageUid: 1
328                 #additionalParameters: ''
329                 #delay: 0
330                 #statusCode: 303
331
332             SaveToDatabase:
333               implementationClassName: 'TYPO3\CMS\Form\Domain\Finishers\SaveToDatabaseFinisher'
334               #options:
335                 #table: ''
336                 #mode: 'insert'
337                 #whereClause: []
338                 #elements:
339                 #  <elementIdentifier>:
340                 #    mapOnDatabaseColumn: <databaseColumnName>
341                 #    saveFileIdentifierInsteadOfUid: false
342                 #    skipIfValueIsEmpty: false
343                 #databaseColumnMappings:
344                 #  <databaseColumnName>:
345                 #    value: 'someValue'
346                 #    skipIfValueIsEmpty: false
347
348           ### VALIDATORS ###
349           validatorsDefinition:
350             NotEmpty:
351               implementationClassName: 'TYPO3\CMS\Extbase\Validation\Validator\NotEmptyValidator'
352             DateTime:
353               implementationClassName: 'TYPO3\CMS\Extbase\Validation\Validator\DateTimeValidator'
354             Alphanumeric:
355               implementationClassName: 'TYPO3\CMS\Extbase\Validation\Validator\AlphanumericValidator'
356             Text:
357               implementationClassName: 'TYPO3\CMS\Extbase\Validation\Validator\TextValidator'
358             StringLength:
359               implementationClassName: 'TYPO3\CMS\Extbase\Validation\Validator\StringLengthValidator'
360               #options:
361                 #minimum: 0
362                 #maximum: 0
363             EmailAddress:
364               implementationClassName: 'TYPO3\CMS\Extbase\Validation\Validator\EmailAddressValidator'
365             Integer:
366               implementationClassName: 'TYPO3\CMS\Extbase\Validation\Validator\IntegerValidator'
367             Float:
368               implementationClassName: 'TYPO3\CMS\Extbase\Validation\Validator\FloatValidator'
369             Number:
370               implementationClassName: 'TYPO3\CMS\Extbase\Validation\Validator\NumberValidator'
371             NumberRange:
372               implementationClassName: 'TYPO3\CMS\Extbase\Validation\Validator\NumberRangeValidator'
373               #options:
374                 #minimum: 0
375                 #maximum: 0
376             RegularExpression:
377               implementationClassName: 'TYPO3\CMS\Extbase\Validation\Validator\RegularExpressionValidator'
378               #options:
379                 #regularExpression: '/^.*$/'
380             Count:
381               implementationClassName: 'TYPO3\CMS\Form\Mvc\Validation\CountValidator'
382               #options:
383                 #minimum: 0
384                 #maximum: 0
385             FileSize:
386               implementationClassName: 'TYPO3\CMS\Form\Mvc\Validation\FileSizeValidator'
387               #options:
388                 #minimum: '0B'
389                 #maximum: '10M'
390             DateRange:
391               implementationClassName: 'TYPO3\CMS\Form\Mvc\Validation\DateRangeValidator'
392               options:
393                 # https://tools.ietf.org/html/rfc3339#section-5.6 -> full-date
394                 format : 'Y-m-d'
395                 #minimum: '2018-03-17'
396                 #maximum: '2018-03-17'
397
398       ########### MIXINS ###########
399       mixins:
400         translationSettingsMixin:
401           translation:
402             translationFile: 'EXT:form/Resources/Private/Language/locallang.xlf'
403             #translatePropertyValueIfEmpty: true
404
405         ########### FORM ELEMENT MIXINS ###########
406         formElementMixins:
407           BaseFormElementMixin: []
408               # The form element type is chosen as the template name by default.
409               # If you want another name you can set it with 'templateName'
410               #templateName: 'CustomTemplateName'
411
412           ReadOnlyFormElementMixin:
413             __inheritances:
414               10: 'TYPO3.CMS.Form.mixins.formElementMixins.BaseFormElementMixin'
415             implementationClassName: 'TYPO3\CMS\Form\Domain\Model\FormElements\GenericFormElement'
416             variants:
417               -
418                 identifier: hide-1
419                 renderingOptions:
420                   enabled: false
421                 condition: 'stepType == "SummaryPage" || finisherIdentifier in ["EmailToSender", "EmailToReceiver"]'
422
423           FormElementMixin:
424             __inheritances:
425               10: 'TYPO3.CMS.Form.mixins.formElementMixins.BaseFormElementMixin'
426             implementationClassName: 'TYPO3\CMS\Form\Domain\Model\FormElements\GenericFormElement'
427             properties:
428               containerClassAttribute: 'input'
429               elementClassAttribute: ''
430               elementErrorClassAttribute: 'error'
431               #gridColumnClassAutoConfiguration:
432               #  viewPorts:
433               #    xs:
434               #      numbersOfColumnsToUse: ''
435               #    sm:
436               #      numbersOfColumnsToUse: ''
437               #    md:
438               #      numbersOfColumnsToUse: ''
439               #    lg:
440               #      numbersOfColumnsToUse: ''
441
442           TextMixin:
443             __inheritances:
444               10: 'TYPO3.CMS.Form.mixins.formElementMixins.FormElementMixin'
445
446           SelectionMixin:
447             __inheritances:
448               10: 'TYPO3.CMS.Form.mixins.formElementMixins.FormElementMixin'
449
450           SingleSelectionMixin:
451             __inheritances:
452               10: 'TYPO3.CMS.Form.mixins.formElementMixins.SelectionMixin'
453
454           MultiSelectionMixin:
455             __inheritances:
456               10: 'TYPO3.CMS.Form.mixins.formElementMixins.SelectionMixin'
457
458           FileUploadMixin:
459             __inheritances:
460               10: 'TYPO3.CMS.Form.mixins.formElementMixins.FormElementMixin'
461             implementationClassName: 'TYPO3\CMS\Form\Domain\Model\FormElements\FileUpload'
462             properties:
463               saveToFileMount: '1:/user_upload/'
464
465         finishersEmailMixin:
466           implementationClassName: 'TYPO3\CMS\Form\Domain\Finishers\EmailFinisher'
467           options:
468             #subject: ''
469             #recipientAddress: ''
470             #recipientName: ''
471             #senderAddress:
472             #senderName: ''
473             #replyToAddress: ''
474             #carbonCopyAddress: ''
475             #blindCarbonCopyAddress: ''
476             #format: 'html'
477             #attachUploads: true
478             #translation:
479             #  language: 'default'
480             # {@format} depends the 'format' value
481             templateName: '{@format}.html'
482             templateRootPaths:
483               10: 'EXT:form/Resources/Private/Frontend/Templates/Finishers/Email/'
484             #partialRootPaths: []
485             #layoutRootPaths: []
486             #variables: {}