werkraummedia/form-file-collection

向TYPO3的EXT:form添加一个渲染文件集合的表单元素

v1.0.0 2023-07-24 12:13 UTC

This package is auto-updated.

Last update: 2024-09-24 14:46:36 UTC


README

添加新的EXT:form元素,用于渲染文件集合,允许访问者选择文件。

概念

表单元素将获取配置的文件集合,并根据包含的文件分配适当的选项。这允许使用允许选择单个或多个选项的现有模板。

EXT:form集成

提供的配置需要通过TypoScript加载。使用一个自由标识符

plugin.tx_form.settings.yamlConfigurations {
    80 = EXT:form_file_collection/Configuration/Form/Setup.yaml
}

默认情况下没有配置模板,请选择现有之一或提供自己的

TYPO3:
  CMS:
    Form:
      prototypes:
        standard:
          formElementsDefinition:
            FileCollection:
              renderingOptions:
                # Allows to switch between different rendering like "Checkbox", "MultiCheckbox" or "RadioButton", etc.
                templateName: 'MultiCheckbox'

现有模板将直接可用。为自定义模板的使用,添加了额外的变量files。

这将注册一个新的表单元素类型FileCollection,可以像这样使用

-
  type: FileCollection
  identifier: file-collection-1
  label: 'File Collection'
  properties:
    fileCollection:
      # UID of the sys_file_collection to use
      uid: 1
      # Optional, default is identifier
      # Defines the property to use as value for form element.
      valueProperty: 'identifier'
      # Optional, default is identifier
      # Defines the property to use as label for form element.
      labelProperty: 'identifier'

两个选项valueProperty和labelProperty用于准备用于可用默认模板的选项变量。

示例

具体示例可以在Tests/Fixtures/form_file_collection_example中找到。