Albrecht Koehnlein
Albrecht Koehnlein

Reputation: 86

TYPO3 EXT:form TypoScript override for a field by its identifier in all forms

I have multiple forms and all have a privacy checkbox which is identified by identifier: privacyCheckbox and I want to dynamically render/override some configuration by typoscript.

This really works fine, if I exactly know the form's identifier and the field's position:

plugin.tx_form {
  settings {
    formDefinitionOverrides {

      # "defaultContact" is my form's name
      defaultContact {
        renderables {
          0 {
            renderables {
              # "7" is the order/position of the privacy field in the form definition
              7 {
                renderingOptions {
                  translation {
                    arguments {
                      label {
                        0 = TEXT
                        0.typolink {
                          parameter = {$global.pids.privacyPage}
                          returnLast = url
                          forceAbsoluteUrl = 1
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}

Instead of "7" I even could use aSpecificKey, if my YAML form definition would look like ...

    renderables:
      myEmailKey:
        defaultValue: ''
        type: Text
        identifier: email
        label: E-Mail
      aSpecificKey:
        type: Checkbox
        identifier: privacyCheckbox

But I want the editor allow to edit the form and rearange the fields, so it always will be saved as ...

    renderables:
      -
        defaultValue: ''
        type: Text
        identifier: email
        label: E-Mail
      -
        type: Checkbox
        identifier: privacyCheckbox

... which would cause an internal numeric array of all fields.

So, now my questions:

Upvotes: 2

Views: 788

Answers (0)

Related Questions