spooner-web / fluid-form-elements
Extbase/Fluid 使用易于使用的流体表单元素
1.0.0
2018-02-05 08:59 UTC
Requires
- php: ^7.0 || ^7.1
- typo3/cms-core: ^8.7
- typo3/cms-extbase: *
- typo3/cms-fluid: *
Requires (Dev)
- phpunit/phpunit: ^5.6
This package is auto-updated.
Last update: 2024-09-15 00:06:58 UTC
README
这是一个简化 Fluid 表单视图助手使用的 TYPO3 扩展。
安装
composer require spooner-web/fluid-form-elements
为什么要使用这些视图助手?
你是否厌倦了重复收集相同的记录用于你的选择?
你是否在 BE 和 FE 两次管理你的标签?
你是否在表单元素周围复制粘贴模板?
现在这些时间已经过去了。使用 Fluid Form Elements 你
- 可以设置自己的模板来包装表单元素
- 可以使用内置的 Bootstrap 模板(默认和水平)
- 自动通过存储库获取你的选择的所有记录(基于给定的属性)
- 自动确定一般标签
tablename.fieldname
- 可以设置 Bootstrap 网格类用于水平表单(默认是 col-sm-3/col-sm-9)
使用方法
安装后,扩展使用全局命名空间 ffe
。
你可以在扩展配置中设置想要的模板(目前是默认和水平 Bootstrap 表单)。
然后你可以在你的扩展中使用新的视图助手直接开始。
使用示例
- 通过使用文本字段视图助手
<ffe:form.textfield property="name" />
你可以得到 Bootstrap 模板
或水平 Bootstrap(v4)div class="form-group"> <label for="<!-- the property path, uses as ID -->"><!-- the determined label --></label> <!-- the rendered textfield by the original Fluid view helper --> </div>
<ffe:form classLabelColumn="col-sm-4" classFieldColumn="col-sm-8"> <div class="form-group row"> <label class="col-form-label <!-- given column bootstrap label class, set in <ffe:form />, default "col-sm-3" -->" for="<!-- the property path, uses as ID -->"><!-- the determined label --></label> <div class="<!-- given column bootstrap field class, set in <ffe:form />, default "col-sm-9" -->"> <!-- the rendered textfield by the original Fluid view helper --> </div> </div> </ffe:form>
- 通过使用选择视图助手
<ffe:form.select property="country" />
它确定在模型背后的属性country
中给出的内容。如果有另一个模型的关联,它将寻找相关的存储库并调用findAll()
来获取所有记录。 - 你可以通过使用它们来覆盖参数,例如
<ffe:form.select property="country" objects="{countries}" />
并可以用你自己的数据填充选择。 - 通过使用参数
label
你可以使用你自己的标签,例如<ffe:form.textarea property="description" label="My description" />
可用的视图助手
- FormViewHelper
- TextfieldViewHelper
- TextareaViewHelper
- SelectViewHelper
- CheckboxViewHelper
- RadioViewHelper