pstaender/silverstripe-customformpage 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

pstaender/silverstripe-customformpage

Composer 安装命令:

composer require pstaender/silverstripe-customformpage

包简介

Define custom form fields via text input in your CMS

README 文档

README

Define you custom form fields in your created CustomFormPage with this straight forward syntax:

    {{ FieldName | My Field: | Dropdown | { "Option1": "Foo", "Option2": "Bar" } }}
    {{ FieldName * | My Required Field: | Textarea }}
    {{ Captcha |  | Recaptcha }}

You can use as many form fields as you like.

Requirements

  • SilverStripe 4+

Arguments

The following arguments are listed separated by | in each {{ }} form field block (sequence of arguments is not arbitrary):

  1. Name: String as CamelCase describing the name of your field; e.g.: Email, FirstName … * the field is required, if ends with *; e.g.: Email *
  2. Title: String as title, can contain every character except the | seperator; e.g. Your eMail:
  3. Class of Field: Can be every existing field class, without the Field appendix; e.g.: Text, Textarea, Email, Dropdown
  4. (assoc.) Array as option for the field * optional * must be JSON * required for DropDownField for instance

Usage in Templates

You can access the form via $CustomForm:

  <% with $MyCustomFormPage %>
    <h1>$Title</h1>
    $CustomForm
  <% end_with %>

Comments and HTML tags

You can use comments # and using html tags. HTML tags will be converted to SilverStripe LiteralFields:

    # My advanced Poll Form Desctiption
    {{ Email * | Your eMail (required): | Email }}
    <hr />
    <h2>Additional Information</h2>
    # Description of something
    {{ Age | Your age: | Dropdown | { "Under20": "younger or just 20", "Over20": "older than 20" } }}

Exclude Fields in form submission

You can explicitly prevent fields to be written in the submission. Just define them in your config:

CustomFormPageSubmission:
  excludeParameters:
    - Foo
    - Bar

Template variables

You can check $FormWasSuccessfullySended and $FormWasSubmitted in your template.

License

(C) 2017 by Philipp Staender, MIT Licence

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-02-05

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固