Project

General

Profile

Actions

Feature #84133

closed

Epic #84132: Introduce variants

Variants - Frontend implementation

Added by Ralf Zimmermann over 6 years ago. Updated about 6 years ago.

Status:
Closed
Priority:
Should have
Category:
Form Framework
Target version:
Start date:
2018-05-24
Due date:
% Done:

100%

Estimated time:
(Total: 0.00 h)
PHP Version:
Tags:
Complexity:
Sprint Focus:
On Location Sprint

Description

Variants allow you to change properties of a form element.
Variants can be made under conditions.
This makes it possible to manipulate form element values, validator options, and finisher options based on conditions.
The allows among other things:

  • translation of form element values depending on the frontend language
  • set and remove validators of one form element depending on the value of another form element
  • hide entire pages depending on the value of a form element
  • set finisher values depending on the value of a form element
  • hiding a form element in certain finishers and on the summary page
  • and much more

This feature implements variants for frontend rendering and the ability to define variants in the formDefinition.
The implementation to define variants in the form editor is done in a separate patchset.

Examples

    # translation of form element values depending on the frontend language

    type: Form
    identifier: test
    prototypeName: standard
    label: DE
    renderingOptions:
      submitButtonLabel: Abschicken
    variants:
      -
        identifier: language-variant-1
        condition: 'siteLanguage.getLocale() == "en_US.UTF-8"'
        label: EN
        renderingOptions:
          submitButtonLabel: Submit
    renderables:
      -
        type: Page
        identifier: page-1
        label: DE
        renderingOptions:
          previousButtonLabel: 'zurück'
          nextButtonLabel: 'weiter'
        variants:
          -
            identifier: language-variant-1
            condition: 'siteLanguage.getLocale() == "en_US.UTF-8"'
            label: EN
            renderingOptions:
              previousButtonLabel: 'Previous step'
              nextButtonLabel: 'Next step'
        renderables:
          -
            type: Text
            identifier: text-1
            label: DE
            properties:
              fluidAdditionalAttributes:
                placeholder: Platzhalter
            variants:
              -
                identifier: language-variant-1
                condition: 'siteLanguage.getLocale() == "en_US.UTF-8"'
                label: EN
                properties:
                  fluidAdditionalAttributes:
                    placeholder: Placeholder
    # set validators of one form element depending on the value of another form element

    type: Form
    identifier: test
    label: test
    prototypeName: standard
    renderables:
      -
        type: Page
        identifier: page-1
        label: Step
        renderables:
          -
            defaultValue: ''
            type: Text
            identifier: text-1
            label: 'Email address'
            variants:
              -
                identifier: variant-1
                condition: 'formValues["checkbox-1"] == 1'
                properties:
                  fluidAdditionalAttributes:
                    required: 'required'
                validators:
                  -
                    identifier: NotEmpty 
                  -
                    identifier: EmailAddress 
          -
            type: Checkbox
            identifier: checkbox-1
            label: 'Subscribe to newsletter'
    # hide entire steps (form pages) depending on the value of a form element (needs https://review.typo3.org/#/c/57049/)

    type: Form
    identifier: test
    prototypeName: standard
    label: Test
    renderables:
      -
        type: Page
        identifier: page-1
        label: 'Page 1'
        renderables:
          -
            type: Text
            identifier: text-1
            label: 'Text 1'
          -
            type: Checkbox
            identifier: checkbox-1
            label: 'Skip page 2'
            variants:
              -
                identifier: hide-1
                condition: 'stepType == "SummaryPage"'
                renderingOptions:
                  enabled: false
      -
        type: Page
        identifier: page-2
        label: 'Page 2'
        variants:
          -
            identifier: variant-1
            condition: 'formValues["checkbox-1"] == 1'
            renderingOptions:
              enabled: false
        renderables:
          -
            type: Text
            identifier: text-2
            label: 'Text 2'
      -
        type: SummaryPage
        identifier: summarypage-1
        label: 'Summary step'

    # set finisher values depending on the application context

    type: Form
    identifier: test
    prototypeName: standard
    label: Test
    renderingOptions:
      submitButtonLabel: Submit
    finishers:
      -
        identifier: Confirmation
        options:
          message: 'Thank you'
    variants:
      -
        identifier: variant-1
        condition: 'applicationContext matches "#Production/Local#"'
        finishers:
          -
            identifier: Confirmation
            options:
              message: 'ouy knahT'
    renderables:
      -
        type: Page
        identifier: page-1
        label: 'Page 1'
        renderingOptions:
          previousButtonLabel: 'Previous step'
          nextButtonLabel: 'Next step'
    # hiding a form element in certain finishers and on the summary step (needs https://review.typo3.org/#/c/57049/)

    type: Form
    identifier: test
    prototypeName: standard
    label: Test
    finishers:
      -
        identifier: EmailToReceiver
        options:
          subject: Testmail
          recipientAddress: tritum@example.org
          recipientName: 'Test'
          senderAddress: tritum@example.org
          senderName: tritum@example.org
    renderables:
      -
        type: Page
        identifier: page-1
        label: 'Page 1'
        renderables:
          -
            type: Text
            identifier: text-1
            label: 'Text 1'
            variants:
              -
                identifier: hide-1
                renderingOptions:
                  enabled: false
                condition: 'stepType == "SummaryPage" || finisherIdentifier in ["EmailToSender", "EmailToReceiver"]'
          -
            type: Text
            identifier: text-2
            label: 'Text 2'
      -
        type: SummaryPage
        identifier: summarypage-1
        label: 'Summary step'

Subtasks 2 (0 open2 closed)

Task #85072: Move property merge behaviorClosedRalf Zimmermann2018-05-24

Actions
Feature #85080: Add a property to control the visibility for form elementsClosedRalf Zimmermann2018-05-25

Actions

Related issues 6 (0 open6 closed)

Related to TYPO3 Core - Feature #83673: Make forms of EXT:form translateableClosed2018-01-24

Actions
Related to TYPO3 Core - Task #82706: Fieldset labels missing in mailsClosedMathias Brodala2017-10-09

Actions
Related to TYPO3 Core - Feature #81593: Usage of constants in YAML filesClosed2017-06-16

Actions
Related to TYPO3 Core - Feature #82211: Allow generlOverride in formDefinitionOverridesClosed2017-08-26

Actions
Related to TYPO3 Core - Task #86196: Centralize ExpressionLanguage Registration via APIClosedSusanne Moog2018-09-07

Actions
Precedes TYPO3 Core - Task #86462: form: Add documentation for variantsClosed2018-05-25

Actions
Actions #1

Updated by Gerrit Code Review over 6 years ago

  • Status changed from New to Under Review

Patch set 12 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/54982

Actions #2

Updated by Ralf Zimmermann over 6 years ago

  • Subject changed from Frontend implementation to Variants - Frontend implementation
Actions #3

Updated by Gerrit Code Review over 6 years ago

Patch set 13 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/54982

Actions #4

Updated by Gerrit Code Review over 6 years ago

Patch set 14 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/54982

Actions #5

Updated by Gerrit Code Review over 6 years ago

Patch set 15 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/54982

Actions #6

Updated by Gerrit Code Review over 6 years ago

Patch set 16 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/54982

Actions #7

Updated by Ralf Zimmermann over 6 years ago

  • Description updated (diff)
Actions #8

Updated by Gerrit Code Review over 6 years ago

Patch set 17 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/54982

Actions #9

Updated by Ralf Zimmermann over 6 years ago

  • Related to Feature #83673: Make forms of EXT:form translateable added
Actions #10

Updated by Gerrit Code Review over 6 years ago

Patch set 18 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/54982

Actions #11

Updated by Gerrit Code Review over 6 years ago

Patch set 19 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/54982

Actions #12

Updated by Mathias Brodala over 6 years ago

  • Sprint Focus set to On Location Sprint

Will try to review this in the upcoming sprint.

Actions #13

Updated by Gerrit Code Review over 6 years ago

Patch set 20 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/54982

Actions #14

Updated by Ralf Zimmermann over 6 years ago

  • Description updated (diff)
Actions #15

Updated by Gerrit Code Review over 6 years ago

Patch set 21 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/54982

Actions #16

Updated by Gerrit Code Review over 6 years ago

Patch set 22 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/54982

Actions #17

Updated by Gerrit Code Review over 6 years ago

Patch set 23 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/54982

Actions #18

Updated by Gerrit Code Review over 6 years ago

Patch set 24 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/54982

Actions #19

Updated by Ralf Zimmermann over 6 years ago

  • Related to Task #82706: Fieldset labels missing in mails added
Actions #20

Updated by Ralf Zimmermann over 6 years ago

Actions #21

Updated by Ralf Zimmermann over 6 years ago

  • Related to Feature #82211: Allow generlOverride in formDefinitionOverrides added
Actions #22

Updated by Gerrit Code Review over 6 years ago

Patch set 25 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/54982

Actions #23

Updated by Gerrit Code Review over 6 years ago

Patch set 26 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/54982

Actions #24

Updated by Gerrit Code Review over 6 years ago

Patch set 27 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/54982

Actions #25

Updated by Gerrit Code Review over 6 years ago

Patch set 28 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/54982

Actions #26

Updated by Gerrit Code Review over 6 years ago

Patch set 29 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/54982

Actions #27

Updated by Björn Jacob over 6 years ago

  • Sprint Focus changed from On Location Sprint to Remote Sprint
Actions #28

Updated by Gerrit Code Review over 6 years ago

Patch set 31 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/54982

Actions #29

Updated by Gerrit Code Review over 6 years ago

Patch set 32 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/54982

Actions #30

Updated by Gerrit Code Review over 6 years ago

Patch set 33 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/54982

Actions #31

Updated by Gerrit Code Review over 6 years ago

Patch set 34 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/54982

Actions #32

Updated by Gerrit Code Review over 6 years ago

Patch set 35 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/54982

Actions #33

Updated by Gerrit Code Review over 6 years ago

Patch set 36 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/54982

Actions #34

Updated by Gerrit Code Review over 6 years ago

Patch set 37 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/54982

Actions #35

Updated by Ralf Zimmermann over 6 years ago

  • Description updated (diff)
Actions #36

Updated by Ralf Zimmermann over 6 years ago

  • Description updated (diff)
Actions #37

Updated by Ralf Zimmermann over 6 years ago

  • Description updated (diff)
Actions #38

Updated by Gerrit Code Review over 6 years ago

Patch set 38 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/54982

Actions #39

Updated by Ralf Zimmermann over 6 years ago

  • Description updated (diff)
Actions #40

Updated by Ralf Zimmermann over 6 years ago

  • Description updated (diff)
Actions #41

Updated by Gerrit Code Review over 6 years ago

Patch set 39 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/54982

Actions #42

Updated by Gerrit Code Review over 6 years ago

Patch set 40 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/54982

Actions #43

Updated by Gerrit Code Review over 6 years ago

Patch set 41 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/54982

Actions #44

Updated by Gerrit Code Review over 6 years ago

Patch set 42 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/54982

Actions #45

Updated by Gerrit Code Review over 6 years ago

Patch set 43 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/54982

Actions #46

Updated by Gerrit Code Review over 6 years ago

Patch set 44 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/54982

Actions #47

Updated by Gerrit Code Review over 6 years ago

Patch set 45 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/54982

Actions #48

Updated by Gerrit Code Review over 6 years ago

Patch set 46 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/54982

Actions #49

Updated by Gerrit Code Review over 6 years ago

Patch set 47 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/54982

Actions #50

Updated by Gerrit Code Review over 6 years ago

Patch set 48 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/54982

Actions #51

Updated by Gerrit Code Review over 6 years ago

Patch set 49 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/54982

Actions #52

Updated by Anja Leichsenring over 6 years ago

  • Sprint Focus changed from Remote Sprint to On Location Sprint
Actions #53

Updated by Gerrit Code Review over 6 years ago

Patch set 50 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/54982

Actions #54

Updated by Gerrit Code Review over 6 years ago

Patch set 51 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/54982

Actions #55

Updated by Gerrit Code Review over 6 years ago

Patch set 52 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/54982

Actions #56

Updated by Gerrit Code Review over 6 years ago

Patch set 53 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/54982

Actions #57

Updated by Gerrit Code Review over 6 years ago

Patch set 54 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/54982

Actions #58

Updated by Gerrit Code Review over 6 years ago

Patch set 55 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/54982

Actions #59

Updated by Gerrit Code Review over 6 years ago

Patch set 56 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/54982

Actions #60

Updated by Gerrit Code Review over 6 years ago

Patch set 57 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/54982

Actions #61

Updated by Gerrit Code Review over 6 years ago

Patch set 58 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/54982

Actions #62

Updated by Gerrit Code Review over 6 years ago

Patch set 59 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/54982

Actions #63

Updated by Gerrit Code Review over 6 years ago

Patch set 60 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/54982

Actions #64

Updated by Gerrit Code Review over 6 years ago

Patch set 61 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/54982

Actions #65

Updated by Gerrit Code Review over 6 years ago

Patch set 62 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/54982

Actions #66

Updated by Gerrit Code Review over 6 years ago

Patch set 63 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/54982

Actions #67

Updated by Ralf Zimmermann over 6 years ago

  • Status changed from Under Review to Resolved
Actions #68

Updated by Susanne Moog about 6 years ago

  • Related to Task #86196: Centralize ExpressionLanguage Registration via API added
Actions #69

Updated by Stefan Neufeind about 6 years ago

  • Precedes Task #86462: form: Add documentation for variants added
Actions #70

Updated by Benni Mack about 6 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF