TYPO3表单:添加定制输入类型

时间:2019-03-28 13:34:32

标签: typo3

我尝试为TYPO3扩展表格添加自定义输入类型。我需要某种时间选择器(而不是日期选择器)和两个由会话变量预填充的字段。

这是该自定义输入类型的YAML定义:

TYPO3:
  CMS:
    Form:
      renderingOptions:
        __inheritances:
          partialRootPaths:
            66: 'EXT:rdforms/Resources/Private/Frontend/Partials/'      
      prototypes:
        standard:
          formElementsDefinition:
            SingleSelectWithBsnr:
              __inheritances:
                10: 'TYPO3.CMS.Form.prototypes.standard.formElementsDefinition.SingleSelect'
              implementationClassName: 'KVT\Rdforms\Domain\Model\FormElements\BsnrOptions'
              renderingOptions:
                templateName: 'SingleSelect'
            SingleSelectWithLanr:
              __inheritances:
                10: 'TYPO3.CMS.Form.prototypes.standard.formElementsDefinition.SingleSelect'
              implementationClassName: 'KVT\Rdforms\Domain\Model\FormElements\LanrOptions'
              renderingOptions:
                templateName: 'SingleSelect'
            Time:
              __inheritances:
                10: 'TYPO3.CMS.Form.mixins.formElementMixins.TextMixin'
              properties:
                displayFormat: 'H:i'
                fluidAdditionalAttributes:
                  pattern: '([012][0-9]:[0-5][0-9])'
              renderingOptions:
                templateName: 'Time'

我的表单配置现在得到类似


renderingOptions:
  submitButtonLabel: Speichern
type: Form
identifier: erfassung
label: erfassung
prototypeName: standard
renderables:
  -
    renderingOptions:
      previousButtonLabel: 'Previous step'
      nextButtonLabel: Speichern
    type: Page
    identifier: page-1
    label: 'Erfassung Einsätze'
    renderables:
      -
        type: GridRow
        identifier: gridrow-2
        label: Stammdaten
        renderables:
          -
            type: SingleSelectWithBsnr
            identifier: singleselect-1
            label: BSNR
            properties:
              bsnr: 1
              prependOptionLabel: 'Bitte auswählen'
              fluidAdditionalAttributes:
                required: required
              gridColumnClassAutoConfiguration:
                viewPorts:
                  lg:
                    numbersOfColumnsToUse: '2'
                  sm:
                    numbersOfColumnsToUse: '6'
            validators:
              -
                identifier: NotEmpty
      -
        properties:
          minimumCopies: 0
          maximumCopies: 10
          showRemoveButton: true
          copyButtonLabel: 'Einsatz hinzufügen'
          removeButtonLabel: 'Einsatz entfernen'
        type: RepeatableContainer
        identifier: repeatablecontainer-1
        label: Einsätze
        renderables:
          -
            type: GridRow
            identifier: gridrow-1
            label: 'Grid: Row'
            renderables:
              -
                defaultValue: ''
                properties:
                  fluidAdditionalAttributes:
                    step: 1
                    required: required
                type: Time
                identifier: number-1
                label: 'Dienst beginn'
                validators:
                  -
                    identifier: NotEmpty
              -
                defaultValue: ''
                properties:
                  fluidAdditionalAttributes:
                    step: 1
                    required: required
                type: Time
                identifier: number-2
                label: 'Dienst Ende'
                validators:
                  -
                    identifier: NotEmpty

当然,我的Partals目录中有一部分用于时间选择器。我有一个类KVT \ Rdforms \ Domain \ Model \ FormElements \ BsnrOptions,它提供一些测试数据。

但是我得到的只是一个隐秘的(没有用的)错误消息,没有中断的提示。

0 个答案:

没有答案