定制 axllent/silverstripe-bootstrap-forms 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

axllent/silverstripe-bootstrap-forms

最新稳定版本:2.0.4

Composer 安装命令:

composer require axllent/silverstripe-bootstrap-forms

包简介

An extension to add CSS classes to Silverstripe forms to play nicer with Twitter Bootstrap

README 文档

README

An extension to add CSS classes to Silverstripe forms to "play nicer" with Twitter Bootstrap, mostly by adding the form-control bootstrap CSS classes to form elements (input, dropdown, submit etc).

This is designed to be a plug-and-play extension, without requiring you to change your existing forms on your website. This includes all forms such as login forms, password reset forms, as well as any other form you have created.

It extends FormField to try provide a transparent "manipulation" of the rendered form fields, adding some bootstrap CSS to the rendered fields. It does not produce bootstrap-specific html for your forms.

FormField unfortunately only has a $this->extend('onBeforeRender', $this); in Field that allows manipulation of the field itself, and not the parent field_holder. This allows only a very limited amount of flexibility, and prevents an extension from changing the field_holder.

Form submit buttons get a btn btn-primary class added, and any other buttons get a btn btn-default class added.

Forms will still need some additional CSS styling (to set spacing) as the form's field_holders cannot be modified to the limitations mentioned above.

Features

It adds the form-control CSS class to all front-end:

  • TextField (and extended classes)
  • TextAreaField
  • DropdownField

It renders CheckboxSetField & OptionsetField with different field templates (see templates/Forms).

It does not:

  • Modify field holders (onBeforeRender() does not allow that)
  • Support FieldGroup (you'll need to use CSS to do that)
  • Apply bootstrap-specific CSS classes to form messages

Requirements

  • Silverstripe ^4 || ^5

Installation

Install via Composer

You can install it via composer with composer require axllent/silverstripe-bootstrap-forms

Basic usage

Simply install (and flush), add the checkbox CSS to your styles and you're good to go.

统计信息

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

GitHub 信息

  • Stars: 4
  • Watchers: 2
  • Forks: 7
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-01-04

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固