netzmacht/contao-form-bundle
Composer 安装命令:
composer require netzmacht/contao-form-bundle
包简介
Form bundle for using symfony forms with Contao CMS
README 文档
README
This bundle enables the power of Symfony forms in your Contao project.
The purpose if not (yet) to provide a fully replacement of Contao Core form handling but to enable you to use form configurations (form generator, data containers) in your application.
Features
- Enables the symfony form component in your application
- Provides a FormGeneratorType to use form based on the backend
- Provides a HtmlType to add plain html to a form
- Provides a backend form theme
- Adds option for the widget allowing to define
class,fe_class,be_classcss attributes
Form generator
If you want to use the form generator to configure your symfony forms - you can do it. This extension ships a FromGeneratorType.
Usage
// Symfony form generator, provided as service form.factory $form = $formFactory->create(Netzmacht\ContaoFormBundle\Form\FormGeneratorType::class, null, ['formId' => 5]); // That's all. Now you can use a symfon form having your form generator form fields.
DCA forms
If you want to create forms based on the data container arrays - you can do it. The extension ships a DcaFormType.
Usage
// Symfony form generator, provided as service form.factory assert($dc instanceof Contao\DataContainer); $form = $formFactory->create( Netzmacht\ContaoFormBundle\Form\DcaFormType::class, null, ['dataContainer' => 'tl_content', 'fields' => ['text'], 'driver' => $dc] );
Warning The support for dca forms is experimental and might have some unforseen issues. It's highly recommended to pass the data container driver as callbacks might need them. Following types are supported so far:
checkboxpasswordradioselecttexttextarea
Backend form theme
This bundle also provides a form theme for the Contao backend. You can enable it in your twig template where the form is used:
{% form_theme form '@NetzmachtContaoForm/form/contao_backend.html.twig' %}
{{ form(form) }}
CSS attributes
Inside the form theme you can use additional classes to add specific styles, this is done by the contaoWidget option
inside a FormType, there is a generic key class and context specific keys for frontend
fe_class and backend be_class:
$builder ->add( 'field', FieldType::class, [ 'contaoWidget' => ['class' => 'generic-class', 'be_class' => 'clr w50', 'fe_class' => 'frontend-class'], ] )
Input filtering
Be aware that the Contao input sanitizing is bypassed by default. If you need the data filtered, especially when
using it in legacy context (f.e. Contao templates) you can filter the data by using the provided input filter
Netzmacht\ContaoFormBundle\Filter\ContaoInputFilter which is provided as service netzmacht.contao_form.input_filter.
Upload handler
By default the uploaded file is available as UploadedFile instance in the form data. If you want to apply the
configured setting form the form field, you might use the Netzmacht\ContaoFormBundle\Form\FormGenerator\UploadHandler
class provided as service netzmacht.contao_form.form_generator.upload_handler.
Roadmap
- Support popular 3rd party form fields
Known limitations
- Unsupported form fields are just ignored (form generator)
- Submit buttons with images are not supported.
netzmacht/contao-form-bundle 适用场景与选型建议
netzmacht/contao-form-bundle 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1.39k 次下载、GitHub Stars 达 7, 最近一次更新时间为 2017 年 12 月 08 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「Forms」 「contao」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 netzmacht/contao-form-bundle 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 netzmacht/contao-form-bundle 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 netzmacht/contao-form-bundle 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Contao Open Source CMS
ConfirmationField is a form field for Atk14 applications. It's like the BooleanField (checkbox) but the ConfirmationField must be ticked.
Field for number with restricted count of digits and decimal places
Diese Contao 4 Erweiterung stellt Google reCAPTCHA V2 in Form eines neuen Formularfeldes im Formulargenerator bereit. This extension provides Google reCAPTCHA V2 in the form of a new form field in the form generator of Contao Open Source CMS.
HTML and form generation
Build forms from schema
统计信息
- 总下载量: 1.39k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 7
- 点击次数: 8
- 依赖项目数: 2
- 推荐数: 0
其他信息
- 授权协议: LGPL-3.0-or-later
- 更新时间: 2017-12-08