mateuszbieniek / ezplatform-form-builder-multi-step-forms
为eZ Platform 2.5表单构建器添加创建多步表单的功能
Requires
- php: >=7.1
- ezsystems/ezplatform-form-builder: ^1.2
- ezsystems/ezpublish-kernel: ^7.5
Requires (Dev)
- friendsofphp/php-cs-fixer: 2.7.*
- phpunit/phpunit: ~7.0
This package is auto-updated.
Last update: 2024-09-18 19:07:18 UTC
README
描述
该插件为eZ Platform EE中的表单构建器提供了一个"步骤"字段,使得表单可以"分步进行"。
使用方法
此插件提供了一个默认(且非常基础)的模板,该模板使用Bootstrap 4创建一个用于步骤转换的轮播图,但您可以使用您喜欢的任何解决方案。要这样做,您将需要覆盖默认模板(EzPlatformFormBuilderMultiStepFormsBundle::form_steps.html.twig
)。
如果步骤字段不是表单中第一个使用的字段,则第一个步骤字段之前的字段将在轮播图下方(在默认模板中)渲染。如果表单中没有步骤字段,则将正常渲染。步骤字段有几个属性
step_class
- 默认模板将添加此CSS类到步骤 <div>
标签。
next_label
- 如果此字段不为空,则默认模板将渲染带有指定标签的"下一步"按钮。
back_label
- 如果此字段不为空,则默认模板将渲染带有指定标签的"上一步"按钮。
custom_template
- 如果此字段不为空,则默认模板将使用此自定义twig文件作为此步骤模板({% include step.step_field.vars.attr["custom_template"] with { 'step': step } %}
)
您可以根据需要添加任何额外的javascript功能(例如:在步骤中的所有字段填写完毕之前禁用"下一步"按钮)。
安装
1. 启用EzPlatformFormBuilderMultiStepFormsBundle
编辑app/AppKernel.php
,并在
new MateuszBieniek\EzPlatformFormBuilderMultiStepFormsBundle\EzPlatformFormBuilderMultiStepFormsBundle(),
在$bundles
数组的末尾添加
2. 安装mateuszbieniek/ezplatform-form-builder-multi-step-forms
composer require mateuszbieniek/ezplatform-form-builder-multi-step-forms