承接 macwinnie/twigbundle-form 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

macwinnie/twigbundle-form

最新稳定版本:1.0.5

Composer 安装命令:

composer require macwinnie/twigbundle-form

包简介

A Twig Bundle providing some helper templating for forms

README 文档

README

This Twig Bundle allows to reuse some helpful Form elements ... as Twig Macros.

WARNING: as always when working with forms ... the view isn't the (only) place to verify if a user is allowed to send specific information ... if you disable a form element or make it read only in the view, you also want to prove the data sent does not contain that specific value changed!

Data structures

As always, a template is using a dedicated data structure to be transferred into a view ... So the following section is on how the data has to be structured for the usage of the provided macros:

Form

The form macro is using a Bootstrap-DIV-based layout and can be adapted easily. To use it, you'll want to require the \macwinnie\TwigbundleForm\FormExtension class as Twig extension:


Form Element

By default, if none of the following options is selected, we'll get a <input> field rendered by this macro. If

Example usage

This is an example of a Twig template on how to build forms and a single form element:

<h3>Form-Testing</h3>

{% set form_data = {
    "create":
    {
        "action": "/tests/helper/?"
    },
    "buttons":
    [
        {
            "text": "submit",
            "class": "btn btn-primary",
            "name": "submitbutton",
            "value": "submit_val"
        }
    ],
    "rows":
    [
        {
            "name": "text",
            "placeholder": "ph text",
            "type": "text",
            "title": "single line textfield"
        }
    ]
} %}

{% import "form.twig" as forms %}
{% import "formelement.twig" as formelement %}

{{ forms.create( form_data ) }}

<hr/>

{{ formelement.create( form_data.rows[0] ) }}

统计信息

  • 总下载量: 80
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-01-14