2

我有多个表单,并且都有一个隐私复选框,identifier: privacyCheckbox我想通过打字稿动态呈现/覆盖某些配置。

如果我确切地知道表单的标识符和字段的位置,这真的很好用:

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
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}

aSpecificKey如果我的 YAML 表单定义看起来像……,我什至可以使用而不是“7”

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

但我希望编辑器允许编辑表单并重新排列字段,所以它总是会保存为...

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

...这将导致所有字段的内部数字数组。

所以,现在我的问题:

  • 有没有办法将我的覆盖设置应用于所有表单,而不必按名称将其应用于每个表单?
  • 是否有另一种方法可以将覆盖应用于字段,而无需手动修改生成的 YAML 或计算字段在表单中的位置?我的意思是,我已经identifier: privacyCheckbox在定义中设置了 - 对吗,我不能使用这个标识符来访问一个字段?
4

0 回答 0