werkraummedia / form-file-collection
向TYPO3的EXT:form添加一个渲染文件集合的表单元素
v1.0.0
2023-07-24 12:13 UTC
Requires
- php: ~8.0.0 || ~8.1.0 || ~8.2.0
- typo3/cms-backend: ^11.5 || ^12.4
- typo3/cms-core: ^11.5 || ^12.4
- typo3/cms-fluid-styled-content: ^11.5 || ^12.4
- typo3/cms-form: ^11.5 || ^12.4
- typo3/cms-frontend: ^11.5 || ^12.4
Requires (Dev)
- codappix/typo3-php-datasets: ^1.3
- friendsofphp/php-cs-fixer: ^3.11
- phpstan/extension-installer: ^1.1
- phpstan/phpstan: ^1.10
- phpstan/phpstan-phpunit: ^1.0
- phpunit/phpunit: ^9.5
- saschaegerer/phpstan-typo3: ^1.8
- typo3/testing-framework: ^7.0
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
中找到。